[Stackless] A question about exceptions
tismer at stackless.com
Tue Nov 28 01:14:26 CET 2006
Kristján V. Jónsson wrote:
> Thanks for your explanation, Christian.
> The reason I am thinking of raising the issue more widely is that there are two problems:
> 1) Exceptions hang around. In a dispatcher loop, for example, they can exist for a long time.
> Some people consider the resources thus tied up to be a leak.
> 2) Some (legacy) logging code we have takes a look at the exception state to decide whether
> it should create a traceback from the current location or the exception that it assumes
> is being handled. If an old and already handled exception is lingering, it prefers that,
> and everyone is confused.
Ok. OK, but...
> And because of this, the real issue, which annoys me:
> The CCP coding guidelines now require everyone to put an sys.exc_clear() in the except: clause
> to kill the exception after handling this.
> Now, I am fighting this last bit, because it makes you feel like working against the language
> rather than with it. And I think that we should be able to identify the places where we
> might run into 1) and 2) above and solve those, rather than to literally litter the code
> with this redundant idiom. But the proponents do have those points, particularly 1) on their
> hand, and am somewhat unhappy that an implementaion detail like this can have the effect
> of putting some really unintuitive and ugly coding guidelines in place.
I think this is a delicate issue, and they will pull good reasons
in, why this must be exactly so. If necessary by the hairs.
So please be aware of fighting wooden heads and shoes. :-)
No, we need really good arguments, but I also found this
annoying for a long time. But a good example why this is
bad is good to have.
The leakage is a bit hard to argue about; it is just one
exception in a frame. If this creates a huge memory problem,
you might also be asked to re-think your design.
The logging code might check if the exception is handled.
Maybe what we need is a better way to distinguish if it
is handled or not? Or do you do logging of exceptions,
whether handled or not? Maybe we should first try to
identify what is really best to have before going for the war.
cheers - chris (of course it is a wart but not an easy one)
Christian Tismer :^) <mailto:tismer at stackless.com>
tismerysoft GmbH : Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9A : *Starship* http://starship.python.net/
14109 Berlin : PGP key -> http://wwwkeys.pgp.net/
work +49 30 802 86 56 mobile +49 173 24 18 776 fax +49 30 80 90 57 05
PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
whom do you want to sponsor today? http://www.stackless.com/
Stackless mailing list
Stackless at stackless.com
More information about the Stackless