-
- Notifications
You must be signed in to change notification settings - Fork 33.6k
Closed
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
Running this code:
import logging class X(Exception): def __getattr__(self, a): raise KeyError(a) # !!! try: raise X() except X: logging.getLogger().exception('') print('ok')does not print "ok" but instead:
# python3.11 repro.py --- Logging error --- Traceback (most recent call last): File "/workspaces/cpython/repro.py", line 8, in <module> raise X() object address : 0x7f3007c67e80 object refcount : 2 object type : 0x7f3015bf0b20 object type name: KeyError object repr : KeyError('__notes__') lost sys.stderrCPython versions tested on:
3.11, CPython main branch
Operating systems tested on:
Linux
Linked PRs
- gh-113358: Fix rendering tracebacks with exceptions with a broken __getattr__ #113359
- [3.12] gh-113358: Fix rendering tracebacks with exceptions with a broken __getattr__ (GH-113359) #114105
- [3.11] gh-113358: Fix rendering tracebacks with exceptions with a broken __getattr__ (GH-113359) #114109
- [3.11] gh-113358: Fix rendering tracebacks with exceptions with a broken __getattr__ (GH-113359) #114118
- [3.12] gh-113358: Fix rendering tracebacks with exceptions with a broken __getattr__ (GH-113359) #114173
- [3.11] gh-113358 Fix rendering tracebacks with exceptions with a broken __getattr__ : Normalize exception #114379
Metadata
Metadata
Assignees
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error