This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients Rhamphoryncus, benjamin.peterson, gvanrossum, pitrou
Date 2008-06-22.20:56:06
SpamBayes Score 0.2327986
Marked as misclassified No
Message-id <1214168164.6056.94.camel@fsol>
In-reply-to <aac2c7cb0806221340n522daf46o2adef01f9f97570@mail.gmail.com>
Content
Le dimanche 22 juin 2008 à 20:40 +0000, Adam Olsen a écrit :
> > How do you duplicate an instance of an user-defined exception? Using
> an
> > equivalent of copy.deepcopy()? It will probably end up much more
> > expensive than the above-mentioned O(n) search.
> 
> Passing in e.args is probably sufficient.

I think it's very optimistic :-) Some exception objects can hold dynamic
state which is simply not stored in the "args" tuple. See Twisted's
Failure objects for an extreme example:
http://twistedmatrix.com/trac/browser/trunk/twisted/python/failure.py

(yes, it is used an an exception: see "raise self" in the trap() method)

> Can be, or will be?  Only the most common behaviour needs to be optimized.

Well, the "most common behaviour" is a very short context chain, which
is already optimized by my reference-avoidance proposal...
History
Date User Action Args
2008-06-22 20:56:09pitrousetspambayes_score: 0.232799 -> 0.2327986
recipients: + pitrou, gvanrossum, Rhamphoryncus, benjamin.peterson
2008-06-22 20:56:07pitroulinkissue3112 messages
2008-06-22 20:56:06pitroucreate