Open blhsing opened 1 month ago
Nice find! When fixing you need to be careful not to change the behavior for existing explicit users of the traceback module. The traceback module has a special sentinel that is passed for 'builtin' traceback formatting, look for builtin_limit
.
Are you still studying the problem? If you are ready to submit, maybe I will close my submission. Be sorry.:)
Bug report
Bug description:
According to the documentation of
sys.tracebacklimit
, it should default to 1000 if not set, so the following snippet:produces a traceback of 1000 frames as expected in 3.12:
But in 3.13 and the current master, it produces a traceback of all 2000 frames:
This is because with issue #110721, traceback is now printed with the traceback module by default, and the traceback module defaults
sys.tracebacklimit
toNone
when not set: https://github.com/python/cpython/blob/c3ed775899eedd47d37f8f1840345b108920e400/Lib/traceback.py#L458whereas the C implementation of the traceback printer has a proper default of 1000 for
sys.tracebacklimit
as documented: https://github.com/python/cpython/blob/c3ed775899eedd47d37f8f1840345b108920e400/Python/traceback.c#L707I will submit a PR to make 1000 the default value for
sys.tracebacklimit
in the Python implementation of the traceback module.CPython versions tested on:
3.13, CPython main branch
Operating systems tested on:
Linux, Windows
Linked PRs