Message 380352 - Python tracker

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.

Content
If you change your script to do
sys.tracebacklimit = abs(limit)
and run it with arg -3, then you get the output you expect:

C:\Users\User\src\cpython>python.bat x.py -3
Running Release|Win32 interpreter...
limit -3
from traceback module:
Traceback (most recent call last):
  File "C:\Users\User\src\cpython\x.py", line 14, in x3
    x2()
  File "C:\Users\User\src\cpython\x.py", line 12, in x2
    x1()
  File "C:\Users\User\src\cpython\x.py", line 10, in x1
    1 / 0
ZeroDivisionError: division by zero

from interpreter:
Traceback (most recent call last):
  File "C:\Users\User\src\cpython\x.py", line 14, in x3
    x2()
  File "C:\Users\User\src\cpython\x.py", line 12, in x2
    x1()
  File "C:\Users\User\src\cpython\x.py", line 10, in x1
    1 / 0
ZeroDivisionError: division by zero


The documentation for traceback mentions the possibility of using negative limits and their meaning:

Print up to limit stack trace entries from traceback object tb (starting from the caller’s frame) if limit is positive. Otherwise, print the last abs(limit) entries. 

https://docs.python.org/3/library/traceback.html#traceback.print_tb