Nick Coghlan added the comment:

This isn't a bug, as "raise exc from None" only hides *display* of the context, 
it doesn't lose the record of the context entirely.

This means Walter's display code is incorrect, as it isn't checking for 
__suppress_context__:

>>> import inspect
>>> try:
...     inspect.signature(lambda x:None).bind()
... except Exception as e:
...     exc = e
... 
>>> exc.__suppress_context__
True

Interestingly, neither PEP 409 *nor* PEP 415 capture the rationale for that 
design: retaining the full context data even when it's hidden by the default 
exception display routines means that you can still debug code that uses "raise 
X from None" inappropriately. (I thought there was an open RFE to make it easy 
to force the traceback module to ignore __suppress_context__ but if there is 
one, I can't find it)

----------
resolution:  -> not a bug
stage: patch review -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24474>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to