homepage

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 Rhamphoryncus
Recipients Rhamphoryncus, benjamin.peterson, gvanrossum, pitrou
Date 2008年06月22日.19:23:21
SpamBayes Score 0.00016397012
Marked as misclassified No
Message-id <aac2c7cb0806221223w2d49b83evfbe0eaed49808167@mail.gmail.com>
In-reply-to <1214161461.6056.44.camel@fsol>
Content
On Sun, Jun 22, 2008 at 1:04 PM, Antoine Pitrou <report@bugs.python.org> wrote:
>
> Antoine Pitrou <pitrou@free.fr> added the comment:
>
> Le dimanche 22 juin 2008 à 17:17 +0000, Adam Olsen a écrit :
>> I meant only that trivial cycles should be detected. However, I
>> hadn't read your patch, so I didn't realize you already knew of a way
>> to create a non-trivial cycle.
>>
>> This has placed a niggling doubt in my mind about chaining the
>> exceptions, rather than the tracebacks. Hrm.
>
> Chaining the tracebacks rather than the exceptions loses important
> information: what is the nature of the exception which is the cause or
> context of the current exception?
I assumed each leg of the traceback would reference the relevant exception.
Although.. this is effectively the same as creating a new exception
instance when reraised, rather than modifying the old one. Reusing
the old is done for performance I believe.
> It is improbable to create such a cycle involuntarily, it means you
> raise an old exception in replacement of a newer one caused by the
> older, which I think is quite contorted. It is also quite easy to avoid
> creating the cycle, simply by re-raising outside of any except handler.
I'm not convinced.
 try:
 ... # Lookup
 except A as a: # Lookup failed
 try:
 ... # Fallback
 except B as b: # Fallback failed
 raise a # The original exception is of the type we want
For this behaviour, this is the most natural way to write it.
Conceptually, there shouldn't be a cycle - the traceback should be the
lookup, then the fallback, then whatever code is about this - exactly
the order the code executed in.
History
Date User Action Args
2008年06月22日 19:23:23Rhamphoryncussetspambayes_score: 0.00016397 -> 0.00016397012
recipients: + Rhamphoryncus, gvanrossum, pitrou, benjamin.peterson
2008年06月22日 19:23:22Rhamphoryncuslinkissue3112 messages
2008年06月22日 19:23:21Rhamphoryncuscreate

AltStyle によって変換されたページ (->オリジナル) /