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 The Compiler
Recipients The Compiler, iritkatriel, vinay.sajip
Date 2021-02-06.15:54:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1612626856.83.0.902540623753.issue43146@roundup.psfhosted.org>
In-reply-to
Content
After upgrading to 3.10a5, calling logging.exception("test") results in:

    --- Logging error ---
    Traceback (most recent call last):
      File "/usr/lib/python3.10/logging/__init__.py", line 1094, in emit
        msg = self.format(record)
      File "/usr/lib/python3.10/logging/__init__.py", line 938, in format
        return fmt.format(record)
      File "/usr/lib/python3.10/logging/__init__.py", line 682, in format
        record.exc_text = self.formatException(record.exc_info)
      File "/usr/lib/python3.10/logging/__init__.py", line 632, in formatException
        traceback.print_exception(ei[0], ei[1], tb, None, sio)
      File "/usr/lib/python3.10/traceback.py", line 113, in print_exception
        te = TracebackException(type(value), value, tb, limit=limit, compact=True)
      File "/usr/lib/python3.10/traceback.py", line 531, in __init__
        need_context = cause is None and not e.__suppress_context__
    AttributeError: 'NoneType' object has no attribute '__suppress_context__'

That method is documented as "This function should only be called from an exception handler.", but the same also happens when e.g. calling traceback.print_exc() (without a current exception) or traceback.print_exception(None, None, None). Both worked fine before 3.10 Alpha 5, the code seems to do None-checks in other places, and typeshed also marks those arguments as Optional.

This seems to have been introduced in https://github.com/python/cpython/pull/24179 for bpo-42877.
History
Date User Action Args
2021-02-06 15:54:16The Compilersetrecipients: + The Compiler, vinay.sajip, iritkatriel
2021-02-06 15:54:16The Compilersetmessageid: <1612626856.83.0.902540623753.issue43146@roundup.psfhosted.org>
2021-02-06 15:54:16The Compilerlinkissue43146 messages
2021-02-06 15:54:16The Compilercreate