[issue28214] Improve exception reporting for problematic __set_name__ attributes

Serhiy Storchaka report at bugs.python.org
Tue Oct 18 07:19:36 EDT 2016


Serhiy Storchaka added the comment:

Updated patch uses C API added in issue28410. It preserves the traceback of original exception:

Traceback (most recent call last):
  File "issue28214.py", line 3, in __set_name__
    1/0
ZeroDivisionError: division by zero

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

Traceback (most recent call last):
  File "issue28214.py", line 5, in <module>
    class TheoreticallyCouldWork:
RuntimeError: Error calling __set_name__ on 'FaultyImplementation' instance 'attr' in 'TheoreticallyCouldWork'

----------
Added file: http://bugs.python.org/file45129/set_name_chain_error_cause_2.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28214>
_______________________________________


More information about the Python-bugs-list mailing list