diff options
Diffstat (limited to 'Lib/traceback.py')
-rw-r--r-- | Lib/traceback.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/traceback.py b/Lib/traceback.py index f61d5db..8247d8f 100644 --- a/Lib/traceback.py +++ b/Lib/traceback.py @@ -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 |