Nick Coghlan <[EMAIL PROTECTED]> added the comment:

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
=======================

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4486>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to