Serhiy Storchaka added the comment:

Shouldn't it be RuntimeError?

Proposed patch makes RuntimeError be raised with chained original exception. 
This preserves more information.

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

During handling of the above exception, another exception occurred:

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/file45028/set_name_error.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