[Stackless] A question about exceptions

Steve Holden steve at holdenweb.com
Sat Nov 25 14:01:21 CET 2006

A pleasure. I'm pretty sure python-dev will tell you to call 
sys-clear_error() if you don't want the references around.


Kristján V. Jónsson wrote:
> Aha, reraising an already handled excepion!
> This sounds perverted enough for me to start complaining to the python-dev.
> Thanks Steve,
> Kristján
> -----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.
> regards
>   Steve
> 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

Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb       http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden

Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list