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 ncoghlan
Recipients barry, ncoghlan, pitrou
Date 2008-12-02.21:17:50
SpamBayes Score 2.8921994e-07
Marked as misclassified No
Message-id <1228252671.54.0.213749577063.issue4486@psf.upfronthosting.co.za>
In-reply-to
Content
Looks to me like the display code is getting confused by the lack of a
non-None __context__ on the KeyError.

Perhaps the "raise ex from cause" syntax should be setting the
__context__ on the "cause" exception if it isn't already set?

Or else we could just special case this kind of weird programmer
behaviour in the display code.
 
=======================
>>> try:
...   raise IOError
... except Exception as ex:
...   ke = KeyError()
...   ke.__context__ = ex
...   raise AttributeError from ke
...
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
IOError

During handling of the above exception, another exception occurred:

KeyError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 6, in <module>
AttributeError
=======================
History
Date User Action Args
2008-12-02 21:17:51ncoghlansetrecipients: + ncoghlan, barry, pitrou
2008-12-02 21:17:51ncoghlansetmessageid: <1228252671.54.0.213749577063.issue4486@psf.upfronthosting.co.za>
2008-12-02 21:17:50ncoghlanlinkissue4486 messages
2008-12-02 21:17:50ncoghlancreate