Repository navigation
Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable() #129354
Copy link
Copy link
Closed
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement
Description
Activity
- added a commit that references this issue
on Jan 27, 2025 I wrote a single big PR to show how the code can look like: PR gh-129359.
I propose to use replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable() to log better (more helpful) error messages.
The drawback is that it changes
sys.unraisablehookarguments: the object is no longer set. In my PR, I had to update multiple tests to check err_msg (string) instead.- addedtype-featureA feature request or enhancementA feature request or enhancementinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
on Jan 27, 2025 - added 10 commits that reference this issue
on Jan 29, 2025 18 remaining items
- added a commit that references this issue
on Feb 5, 2025 - added 9 commits that reference this issue
on Feb 7, 2025 - added a commit that references this issue
on Apr 2, 2025 - added a commit that references this issue
on Jul 31, 2025
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement
Python 3.13 added
PyErr_FormatUnraisable(format, ...)which allows logging a specific error message, whereasPyErr_WriteUnraisable()always logs the generic "Exception ignored in ..." message.I propose to use replace
PyErr_WriteUnraisable()withPyErr_FormatUnraisable()to log better (more helpful) error messages.Linked PRs