Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #110808

Re: "for/while ... break(by any means) ... else" make sense?

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Zachary Ware <zachary.ware+pylist@gmail.com>
Newsgroups comp.lang.python
Subject Re: "for/while ... break(by any means) ... else" make sense?
Date Wed, 29 Jun 2016 23:47:55 -0500
Lines 43
Sender zachary.ware@gmail.com
Message-ID <mailman.120.1467262104.2358.python-list@python.org> (permalink)
References <CAGtOLTe8VOnW6zbQSpoCwLL8Hj=cvF6wZ7wx-gxO=9-bQQ0fMw@mail.gmail.com> <mailman.101.1467194475.2358.python-list@python.org> <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> <CAKJDb-NzPx0m=T2SNgb=c-BU1BP81x_29KGgvaOuLpnnSgRtjQ@mail.gmail.com>
Reply-To python-list@python.org
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de O3hGkD7QqAGsSgCRNxfNIAwfB6/1BkG2stOuWyUsmUpQ==
Return-Path <zachary.ware@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'handler': 0.04; 'pop': 0.05; 'skip:/ 10': 0.07; 'abort': 0.09; "ain't": 0.09; 'exits': 0.09; 'skip:` 30': 0.09; 'stderr': 0.09; 'subject:while': 0.09; 'python': 0.10; 'wed,': 0.15; 'interpreter': 0.15; 'thu,': 0.15; '2016': 0.16; 'enlighten': 0.16; 'osx': 0.16; 'received:io': 0.16; 'received:mail-oi0-x230.google.com': 0.16; 'received:psf.io': 0.16; 'segfault': 0.16; 'similarly,': 0.16; 'subject:break': 0.16; 'subject:make': 0.16; 'wrote:': 0.16; 'sender:addr:gmail.com': 0.18; 'url:default': 0.18; '>>>': 0.20; 'to:name:python- list@python.org': 0.20; 'function,': 0.22; 'null;': 0.22; 'am,': 0.23; 'tried': 0.24; 'header:In-Reply-To:1': 0.24; "doesn't": 0.26; 'chris': 0.26; 'message-id:@mail.gmail.com': 0.27; 'actual': 0.28; 'crash': 0.29; 'dialog': 0.29; 'dumps': 0.29; 'equivalent.': 0.29; 'windows,': 0.29; 'subject:/': 0.30; 'code': 0.30; 'somebody': 0.30; "can't": 0.32; 'core': 0.32; 'url:python': 0.33; 'call,': 0.33; "d'aprano": 0.33; 'point,': 0.33; 'steven': 0.33; 'traceback': 0.33; 'me?': 0.34; 'received:google.com': 0.35; 'on,': 0.35; 'execution': 0.35; 'possible,': 0.35; 'stopped': 0.35; 'but': 0.36; 'url:org': 0.36; 'possible.': 0.36; 'subject:" ': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'really': 0.37; 'setting': 0.37; 'say': 0.37; 'skip:p 20': 0.38; 'skip:o 20': 0.38; 'sure': 0.39; 'does': 0.39; "didn't": 0.39; 'along': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'called': 0.40; 'some': 0.40; 'entire': 0.61; 'back': 0.62; '30,': 0.63; 'here:': 0.63; 'header:Reply-To:1': 0.67; 'manner': 0.69; 'reply-to:no real name:2**0': 0.71; 'quickest': 0.84; 'reply- to:addr:python.org': 0.84; 'scary': 0.84; 'subject:any': 0.84; 'subject:else': 0.84; 'subject:sense': 0.84; 'url:cpython': 0.84; 'hardest': 0.91; 'hands': 0.96
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:from:date :message-id:subject:to; bh=t6PPbERZ+x5q3S0BYQolfLLEm831g9tZFEN+OS1UfJQ=; b=FX+2aKuyk6lbz3XYy2xV/jlorf3FPievB+0PA2h8S2t0HG2XeZ2H3PYDueRraZe1Kv zDRbl8nh4YrH72ySQe3mh7o3bodgC7SDo9PhCFt/rwI95zaKl37bYEe4huD3+8pSohOS WXqREWfP2bnwFs7rrFvGed+fP/H1SvdT2kpwnzTMXWvJqeZLcL0HicUmLOmvaDVB94jt 4cAFBEicwxMKVA4ztdutCCZu8RNerE2HFESyGWaEKKziskLxIjdtCDo3tPzWbwN2lR9S uOtIXxL08qz2YHGGmuO3/bFyGksZZISwyB3o/mm3PjRHbaa74hraEKhdJFIkRIpF39Uc 1f0A==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:sender:in-reply-to :references:from:date:message-id:subject:to; bh=t6PPbERZ+x5q3S0BYQolfLLEm831g9tZFEN+OS1UfJQ=; b=cOFyNXVpvowH091GAfE/MVjecnKdd8OZlQCXAWooaIjPtT0CWb779qzQQCUB9fz+Kf PIN4Ye+0yKCNjxZO+1Z91YjJYOt90TxlRjLZCmHbr9NAaNw3cFyalRXDSy4PTIEIymlS 6rX7v0fNWbrw1UeY5h1g0vt3gEVV57dPKq37si4Es0xWpa3OqM9ujLKipaVFafTL6brE kvwfR6IpdNg7tVhywW6N9RA+eVpBl4BKezADLXfdDIScjhy8BWnwjpHTRBFyBCKxZB77 NpuuZY2rNb+OflAZQz7jTUZZClpzPZnZFnpdGM200koAQc4wgLhABiwy4aRX5l/SKuZC EuWA==
X-Gm-Message-State ALyK8tJ59Eo3forkUpVdpzeSGRwJJoGli56bJrxM3sJCdaobflojrFVrQF8/IsjrX4wDRas5NzuDR29VqhXtHA==
X-Received by 10.157.7.40 with SMTP id 37mr7877331ote.145.1467262095005; Wed, 29 Jun 2016 21:48:15 -0700 (PDT)
In-Reply-To <57749c30$0$1598$c3e8da3$5496439d@news.astraweb.com>
X-Google-Sender-Auth TwGwxfkwQrTTIo8KQglMptOdw2I
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <CAKJDb-NzPx0m=T2SNgb=c-BU1BP81x_29KGgvaOuLpnnSgRtjQ@mail.gmail.com>
X-Mailman-Original-References <CAGtOLTe8VOnW6zbQSpoCwLL8Hj=cvF6wZ7wx-gxO=9-bQQ0fMw@mail.gmail.com> <mailman.101.1467194475.2358.python-list@python.org> <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>
Xref csiph.com comp.lang.python:110808

Show key headers only | View raw


On Wed, Jun 29, 2016 at 11: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?

Right here: https://hg.python.org/cpython/file/default/Modules/posixmodule.c#l10528

Here's the entire implementation of os.abort:
{
    abort();
    /*NOTREACHED*/
    Py_FatalError("abort() called from Python code didn't abort!");
    return NULL;
}

abort(3) is a standard C function, see the manpage.  If execution
somehow makes it past the abort() call, Python does its best to make
sure it really doesn't by calling Py_FatalError, which dumps a scary
message to stderr along with any traceback it can get its hands on,
then calls abort() again.  I tried setting a signal handler for
SIGABRT (I tried `signal.signal(signal.SIGABRT, print)`), but it
didn't trigger a Py_FatalError call on OSX or Linux.

On Windows, abort() causes the "some.exe has stopped working" dialog
to pop up and "search for solutions".  Similarly, the Crash Reporter
pops up on OSX.

-- 
Zach

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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