Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

AFAIK there is existing issue for this idea.

I have doubts about performance. I added _PyObject_LookupAttr in particularly 
to avoid an overhead of raising and silencing an AttributeError. I believe most 
performance sensitive code in the core now uses it and will not be affected, 
but there is other code which silences it (_PyObject_LookupAttr itself silences 
an AttributeError raised in called functions), third-party code which uses 
PyObject_HasAttr or PyObject_GetAttr can be affected.

It might be simpler to implement it in sys.excepthook or sys.displayhook, but 
at that point we do not have attribute name and a reference to the object. 
There is an issues and a PEP about adding references to AttributeError. It 
could help to implement this feature.

----------

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

Reply via email to