[Stackless] A question about exceptions

Kristján V. Jónsson kristjan at ccpgames.com
Sat Nov 25 12:12:25 CET 2006

Aha, reraising an already handled excepion!
This sounds perverted enough for me to start complaining to the python-dev.

Thanks Steve,


-----Original Message-----
From: stackless-bounces at stackless.com [mailto:stackless-bounces at stackless.com] On Behalf Of Steve Holden
Sent: 24. nóvember 2006 18:47
To: stackless at stackless.com
Subject: Re: [Stackless] A question about exceptions

I suppose it's required by a raise statement with no exception. This can 
be executed at any time after an exception is caught.Can't think of any 
other reason anyway.


Kristján V. Jónsson wrote:
> Well, Perhaps My question wasn't clear enough:
> def foo():
> 	try:
> 		1/0
> 	except ZeroDivisionError:
> 		HandleError()
> 		#sys.clear_error()  #this appears necessary
> 	#exception has been handled.
> 	import sys
> 	print sys.get_exc() #here we still get the exception.  Why?
> My question is more, why are we keeping the exception state around with the frame _after_ any handling has taken
> place?  If we want to examine the exception at some later date, we can store it using sys.get_exc() and do it
> excplicitly.  It seems strange to hang on to it after we have handled it, (in fact, requiring exc_clear() to get rid of the gunk sometimes)
> which is why I am asking if there is some obscure language design or implementation feature that requires it.
> K

Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list