SystemExit

Jaap Vermeulen (jaap@sequent.com)
Mon, 10 May 1993 10:38:45 -0700

I have some gripes about the SystemExit.

Firstly all the code that used to work, such as:

try:
some code that includes an sys.exit() deep down
except:
something else

doesn't work any more since it's entering the except. What I want is
catching all possible scenarios *except* system exit. Yes I could use
posix._exit(), but that doesn't flush things properly etc.

Now I'm forced to write:

try:
some code that includes and sys.exit() deep down
except:
if sys.exc_type == SystemExit: sys.exit()
something else

for every such contruct.

Furthermore, if I were to use the posix._exit() function, I can't on DOS
since it doesn't exist. As a matter of fact I had to clean up the os.py
module to work properly by changing the line:

try:
from posix import *
from posix import _exit
name = 'posix'
...

to:

try:
from posix import *
try: from posix import _exit
except: pass
name = 'posix'
...

I know that I'm the one that was asking for a cleanup function, which
Guido dutifully implemented, but I didn't ask for an exception if I
just want to exit. Except for the solutions outlined above, does
somebody else come up with a convenient solution?

Looks like backwards compatibility is slightly broken here. And I
don't really see the rational for this change, since I could have
raised the exception myself if I needed it.

Thanks,

-Jaap-

--
Jaap Vermeulen					+--------------------------+
						| Sequent Computer Systems |
	Internet : jaap@sequent.com		| Beaverton, Oregon	   |
	Uucp	 : ...uunet!sequent!jaap	+--------------------------+