Serhiy Storchaka added the comment:

Alternative patch chain original exception as __cause__ instead of __context__. 
What is better?

>>> class FaultyImplementation:
...     def __set_name__(self, *args):
...         1/0
... 
>>> class TheoreticallyCouldWork:
...     attr = FaultyImplementation()
... 
ZeroDivisionError: division by zero

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

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: Error calling __set_name__ on 'FaultyImplementation' instance 
'attr' in 'TheoreticallyCouldWork'

----------
Added file: http://bugs.python.org/file45029/set_name_chain_error_cause.patch

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

Reply via email to