mirror of
https://github.com/python/cpython.git
synced 2025-08-01 23:53:15 +00:00
[3.12] gh-113358: Fix rendering tracebacks with exceptions with a broken __getattr__ (GH-113359) (#114173)
This commit is contained in:
parent
afefa4a74c
commit
00e8c9ce9e
4 changed files with 53 additions and 2 deletions
|
@ -738,7 +738,11 @@ class TracebackException:
|
|||
# Capture now to permit freeing resources: only complication is in the
|
||||
# unofficial API _format_final_exc_line
|
||||
self._str = _safe_string(exc_value, 'exception')
|
||||
self.__notes__ = getattr(exc_value, '__notes__', None)
|
||||
try:
|
||||
self.__notes__ = getattr(exc_value, '__notes__', None)
|
||||
except Exception as e:
|
||||
self.__notes__ = [
|
||||
f'Ignored error getting __notes__: {_safe_string(e, '__notes__', repr)}']
|
||||
|
||||
if exc_type and issubclass(exc_type, SyntaxError):
|
||||
# Handle SyntaxError's specially
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue