Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: "for/while ... break(by any means) ... else" make sense? Date: Thu, 30 Jun 2016 14:40:20 +1000 Lines: 33 Message-ID: References: <57746765$0$1593$c3e8da3$5496439d@news.astraweb.com> <57749c30$0$1598$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de Q4bWXP3oQ7V3R1wYCjFSiwa4seeti8O6j5q7MZm6H3IA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'sys.platform': 0.07; 'terminated': 0.07; 'cc:addr:python-list': 0.09; 'abort': 0.09; "ain't": 0.09; 'exits': 0.09; 'expectation': 0.09; 'subject:while': 0.09; 'def': 0.13; 'interpreter': 0.15; 'thu,': 0.15; '2016': 0.16; 'enlighten': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'segfault': 0.16; 'subject:break': 0.16; 'subject:make': 0.16; 'wrote:': 0.16; 'linux,': 0.18; '>>>': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'am,': 0.23; 'this:': 0.23; 'tried': 0.24; 'header:In-Reply-To:1': 0.24; 'chris': 0.26; 'message-id:@mail.gmail.com': 0.27; 'actual': 0.28; 'equivalent.': 0.29; 'recorded': 0.29; 'subject:/': 0.30; 'somebody': 0.30; "can't": 0.32; 'core': 0.32; 'possibly': 0.32; "d'aprano": 0.33; 'point,': 0.33; 'steven': 0.33; 'me?': 0.34; 'received:google.com': 0.35; 'possible,': 0.35; 'something': 0.35; 'but': 0.36; 'possible.': 0.36; 'subject:" ': 0.36; 'subject:?': 0.36; 'pm,': 0.36; 'say': 0.37; 'skip:o 20': 0.38; 'where': 0.40; 'some': 0.40; 'back': 0.62; '30,': 0.63; 'manner': 0.69; 'chrisa': 0.84; "it'd": 0.84; 'quickest': 0.84; 'subject:any': 0.84; 'subject:else': 0.84; 'subject:sense': 0.84; 'to:none': 0.91; 'hardest': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:cc; bh=x94q2X+gykKRhw+rwGdWNmmI1mgk3XCHSN5m3he/1XM=; b=fGa3XvVLf/LawwhhSvVEhrhOHkeq3SCbNosnofdkk2vwjaOKIUSKI3q2L853wNXSIN eTZl81Fdjdeeoh3qsSi0lqC8wC4kkDXq/6hf+Nz/ARHyhd8uLZWS5o4kg9yAX1LSTF1j VULBHTGFECbps/ewcVKw5Vh/fL1fSRboFf0jinXQMb2McWH+uWVKrQHhRpqs2Vxm6CwJ CKw8KOpMmc/80mJK2Mh3QxBuSTKXK9mEszAUmCZTkEu4zAHvbHJtVEcEfkRmMa2FWmd2 Fml00KcXbW60swEqHvalfa/iMW/0uSFmBF0+pmVuGH0Wj5YdDNky46oKjoNNkv5C1Loc cwww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:cc; bh=x94q2X+gykKRhw+rwGdWNmmI1mgk3XCHSN5m3he/1XM=; b=d4/1/QiwmsLQjnzCsD9HY34bXPJFhz8oey+UxDTypy6KPLiC1LLZa4YBjihFbXfp75 cr0yctdWioNvbUnb3qlpCWHaE7nFzJSdk7TqNQTlDlfIkU0SDJ3lt18ymtHYcpoyR4l3 lqQDAqljFrwuahbL0ahOceAzuOIvAe1n3gxZu00myO98eKJcqU7JJ132lbJWRx5D++C7 o/n4Ufr4q2dI+nnF853veIXJWSrQ/GmjczNACMu/I/FxRn4tYlCOqaJTh83S+lgmnquu dVVtfoX7x4Q7h8MM3WklzpleXC0WsU1WL6sB4NmbLGoi89UQ5yPvKOxscycAyL/uAamP P3zw== X-Gm-Message-State: ALyK8tLQPedijM2AQJi9/nNCai27rCbVp8Jezeiu1AsazAEm0ymBtkw3ZF+ni6Iw03pTZMGIwof2rNBNuMSCuA== X-Received: by 10.194.70.41 with SMTP id j9mr11418219wju.30.1467261620724; Wed, 29 Jun 2016 21:40:20 -0700 (PDT) In-Reply-To: <57749c30$0$1598$c3e8da3$5496439d@news.astraweb.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <57746765$0$1593$c3e8da3$5496439d@news.astraweb.com> <57749c30$0$1598$c3e8da3$5496439d@news.astraweb.com> Xref: csiph.com comp.lang.python:110807 On Thu, Jun 30, 2016 at 2:12 PM, Steven D'Aprano wrote: > On Thu, 30 Jun 2016 11:28 am, Chris Angelico wrote: > >> On Thu, Jun 30, 2016 at 10:27 AM, Steven D'Aprano >> 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