Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #110807
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: "for/while ... break(by any means) ... else" make sense? |
| Date | 2016-06-30 14:40 +1000 |
| Message-ID | <mailman.119.1467261623.2358.python-list@python.org> (permalink) |
| References | (2 earlier) <57746765$0$1593$c3e8da3$5496439d@news.astraweb.com> <CAPTjJmqAmesf58J9bYa7_vWXTtjnFU7JrkGy5hoqFNC3tTx-8Q@mail.gmail.com> <mailman.116.1467250108.2358.python-list@python.org> <57749c30$0$1598$c3e8da3$5496439d@news.astraweb.com> <CAPTjJmqwZKCqnr1mz4_D8SPVXKttHPuOnJrDPi-1-Zxk9aZ=hw@mail.gmail.com> |
On Thu, Jun 30, 2016 at 2:12 PM, Steven D'Aprano <steve@pearwood.info> wrote:
> On Thu, 30 Jun 2016 11:28 am, Chris Angelico wrote:
>
>> On Thu, Jun 30, 2016 at 10:27 AM, Steven D'Aprano <steve@pearwood.info>
>> wrote:
>>> Following os.abort(), the interpreter exits in the hardest, quickest
>>> manner possible.
>>
>> os.kill(os.getpid(), 9)
>>
>> Now THAT is the hardest way to abort. You ain't comin' back from this one!
>
> The docs say it will abort in the hardest way possible, by dumping core or
> equivalent. I *think* I recall seeing os.abort() actually segfault at some
> point, but I can't replicate that now.
>
> I tried to find the actual implementation of os.abort(), but I couldn't work
> out where it was or what it does. Can somebody enlighten me?
My expectation is that it'd be something like this:
def abort():
if sys.platform == 'windows':
some_win32_api_call()
signal.signal(signal.SIGABRT, signal.SIG_DFL)
kill(getpid(), signal.SIGABRT)
Certainly, after a call to os.abort() under Linux, the process is
recorded as having terminated with signal 6 (SIGABRT), and the
intended purpose of that signal is "abort the process abnormally,
possibly dumping core".
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: "for/while ... break(by any means) ... else" make sense? Victor Savu <victor.nicolae.savu@gmail.com> - 2016-06-29 10:01 +0000
Re: "for/while ... break(by any means) ... else" make sense? Steven D'Aprano <steve@pearwood.info> - 2016-06-30 10:27 +1000
Re: "for/while ... break(by any means) ... else" make sense? Chris Angelico <rosuav@gmail.com> - 2016-06-30 11:28 +1000
Re: "for/while ... break(by any means) ... else" make sense? Rustom Mody <rustompmody@gmail.com> - 2016-06-29 19:26 -0700
Re: "for/while ... break(by any means) ... else" make sense? Random832 <random832@fastmail.com> - 2016-06-30 00:00 -0400
Re: "for/while ... break(by any means) ... else" make sense? Steven D'Aprano <steve@pearwood.info> - 2016-06-30 14:12 +1000
Re: "for/while ... break(by any means) ... else" make sense? Chris Angelico <rosuav@gmail.com> - 2016-06-30 14:40 +1000
Re: "for/while ... break(by any means) ... else" make sense? Zachary Ware <zachary.ware+pylist@gmail.com> - 2016-06-29 23:47 -0500
Re: "for/while ... break(by any means) ... else" make sense? Random832 <random832@fastmail.com> - 2016-06-30 00:59 -0400
csiph-web