Message245543
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) |
|
Date |
User |
Action |
Args |
2015-06-20 06:28:35 | ncoghlan | set | recipients:
+ ncoghlan, doerwalter, larry, yselivanov |
2015-06-20 06:28:35 | ncoghlan | set | messageid: <1434781715.44.0.885055665732.issue24474@psf.upfronthosting.co.za> |
2015-06-20 06:28:35 | ncoghlan | link | issue24474 messages |
2015-06-20 06:28:34 | ncoghlan | create | |
|