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 Julian
Recipients Julian, vstinner
Date 2021-02-06.20:55:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1612644956.56.0.525565389562.issue43148@roundup.psfhosted.org>
In-reply-to
Content
At the REPL, when sys.excepthook is broken (below by setting it to a non-callable), one sees:

```
⊙  python3.9                                                                                                                                                                        julian@Airm
Python 3.9.1 (default, Feb  2 2021, 22:54:59) 
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys; sys.excepthook = object(); asdf
Error in sys.excepthook:
TypeError: 'object' object is not callable

Original exception was:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'asdf' is not defined
```

The implementation (https://github.com/python/cpython/blob/5f18c223391eef8c7d01241b51a7b2429609dd84/Python/pythonrun.c#L805-L817) seems to do so by reimplementing something like 3.8+'s sys.unraisablehook (well, technically it predates sys.unraisablehook by quite a while).

Seems like now that it exists, that code should now call sys.unraisablehook.
History
Date User Action Args
2021-02-06 20:55:56Juliansetrecipients: + Julian, vstinner
2021-02-06 20:55:56Juliansetmessageid: <1612644956.56.0.525565389562.issue43148@roundup.psfhosted.org>
2021-02-06 20:55:56Julianlinkissue43148 messages
2021-02-06 20:55:56Juliancreate