[Patches] [ python-Patches-697613 ] fix bug #670311: sys.exit and PYTHONINSPECT

SourceForge.net noreply at sourceforge.net
Wed Mar 7 01:35:06 CET 2007


Patches item #697613, was opened at 2003-03-04 23:24
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=697613&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core (C code)
Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Michael Stone (mbrierst)
Assigned to: Nobody/Anonymous (nobody)
Summary: fix bug #670311: sys.exit and PYTHONINSPECT

Initial Comment:

So we want to stop SystemExit from causing
an actual exit() when using python -i.
This patch introduces two new API calls,
PyRun_BlockSysExit and PyRun_UnblockSysExit,
to set a flag toavoid the exit() call in
PyErr_PrintEx.

There are several other ways to fix this
bug, but I think all of the others I came up
with would cause more backwards compatibilty
problems and/or be a lot more work.
Some possibilities, if anyone is interested,
would be:
1) Add a new PyCompilerFlags flag
This seems a bit ugly, as it's not really
a "compile flag".
2) Add some special run routines that
block the exit.
3) Add another parameter to existing
run routines.
4) Change PyErr_PrintEx so it doesn't
exit when printing a SystemError, instead
having the run routines responsible for
exiting when catching that exception.

What do you think?  Is my patch good enough,
or would you like something else?

----------------------------------------------------------------------

>Comment By: Georg Brandl (gbrandl)
Date: 2007-03-07 00:35

Message:
Logged In: YES 
user_id=849994
Originator: NO

Committed a variant as rev. 54188.

----------------------------------------------------------------------

Comment By: Georg Brandl (birkenfeld)
Date: 2005-02-23 18:29

Message:
Logged In: YES 
user_id=1188172

While it works for me, I am not sure whether this is too
much overhead for fixing a glitch no one else complained about.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=697613&group_id=5470


More information about the Patches mailing list