Path: csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.029 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'subject:Python': 0.04; 'handler': 0.05; 'python': 0.07; 'pm,': 0.11; 'wrote:': 0.14; 'abort': 0.16; 'dumps': 0.16; 'return.': 0.16; 'header:In-Reply- To:1': 0.22; 'subject:code': 0.23; 'script': 0.26; 'chris': 0.27; 'message-id:@mail.gmail.com': 0.28; 'core': 0.28; 'sat,': 0.29; 'like.': 0.29; 'to:addr:python-list': 0.32; 'another': 0.32; 'force': 0.35; 'normally': 0.35; 'trigger': 0.35; 'received:209.85': 0.37; 'exactly': 0.37; 'apr': 0.38; 'received:google.com': 0.38; 'but': 0.38; 'signal': 0.39; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'would': 0.40; 'header:Received:5': 0.40; '2011': 0.62; 'our': 0.63; '30,': 0.80; 'received:209.85.210.174': 0.84; 'received:mail- iy0-f174.google.com': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=BJSD2OoazcFT0Dr2K4rxCBC6WgaZ/1LGy97qZf7fwMM=; b=U/qAQ7RQ1EFRy+31vlEsXcr1I09o5RCOMKu8tjHy5eJMdC1nnwLErCh0Y+t1kzI1xa NxUs4Mp1HWEQqUUNEtko4TmIu14Z+YNn+QHLrfym0mFWiOs70G6al+87j4uU5sMh83Mh WFFUcxZZyzT9k8EgGzeQctPU9k2IiguntjRmE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=u2TIrUveubV1Lp0u/81G7zJnLYPjE/v6zBqsEs0vD1/IxI7Ho/dlUoSTH1naCJ1Jv7 Sqzvf+Qjs+M+aTukg6GB4X/D0zY+unrvLlIARqzHxjz3NbtfUvRN/CTgUKfCRojRr4eB 0qXscJCibRUG0XJsUUi0xUfOx1DLhwrpsf6io= MIME-Version: 1.0 In-Reply-To: References: Date: Sat, 30 Apr 2011 18:17:10 +1000 Subject: Re: Aborting Python from C code From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 12 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1304151439 news.xs4all.nl 81481 [::ffff:82.94.164.166]:57727 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:4192 On Sat, Apr 30, 2011 at 6:08 PM, Miki Tebeka wrote: >> In our sandboxed Python environment, I would like to be able to >> trigger an abort of the currently-running Python script (from a signal >> handler or another thread). > There's os.abort That core dumps the process; what I want is to force the PyRun_StringFlags to return. Normally PyErr_SetInterrupt will do exactly this (within a few instructions is fine), but the Python script is able to prevent that from happening, which I don't like. Chris Angelico