This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients BTaskaya, james, pablogsal, serhiy.storchaka, vstinner, xtreak, yselivanov
Date 2019-10-28.11:17:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Helping the developer to suggest a fix introduces a minor but non-zero overhead, I would prefer to only enable it as an opt-in option. Maybe enable it using in the development mode (-X dev/PYTHONDEVMODE=1)?

> (by James Powell)

This project hooks into PyObject_GetAttr() by modifying PyObject_GetAttr() machine code, which is definitely not a portable approach.

Maybe one approach would be to add a way to install a hook to customize AttributeError exceptions?

Can this issue be implemented using sys.excepthook?


This issue is specific to AttributeError, but I vaguely recall that Yury Selivanov told me that he wanted to something but for any exception. Detect the most common mistakes and propose a solution. I don't think that he ever sent anything in public sadly.

I add Yury in the nosy list.


Here is another project which also catch NameError, AttributeError, ImportError, TypeError, ValueError, SyntaxError, MemoryError, OverflowError, OSError, RuntimeError, etc. :

It is implemented with sys.excepthook, but it is also compatible with IPython "custom exception handler" (call get_ipython().set_custom_exc()).

By the way, does IPython have a feature like this?

In short, seems to already implement this issue in the proper way, no?


Similar project for Ruby:
Date User Action Args
2019-10-28 11:17:59vstinnersetrecipients: + vstinner, serhiy.storchaka, yselivanov, james, pablogsal, xtreak, BTaskaya
2019-10-28 11:17:59vstinnersetmessageid: <>
2019-10-28 11:17:59vstinnerlinkissue38530 messages
2019-10-28 11:17:59vstinnercreate