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 JelleZijlstra
Recipients JelleZijlstra, gvanrossum, iritkatriel
Date 2022-03-07.17:05:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1646672733.16.0.448459715427.issue46949@roundup.psfhosted.org>
In-reply-to
Content
It skips the least recent frames:

>>> def error(): 1 / 0
... 
>>> def g(): error()
... 
>>> def f(): g()
... 
>>> sys.tracebacklimit = 2
>>> f()
Traceback (most recent call last):
  File "<stdin>", line 1, in g
  File "<stdin>", line 1, in error
ZeroDivisionError: division by zero
>>> sys.tracebacklimit = 5
>>> f()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 1, in f
  File "<stdin>", line 1, in g
  File "<stdin>", line 1, in error
ZeroDivisionError: division by zero

(tried on current main)

I think that's the right behavior because it tells you the function that actually throws the error, which is much harder to figure out from scratch than where the call started.
History
Date User Action Args
2022-03-07 17:05:33JelleZijlstrasetrecipients: + JelleZijlstra, gvanrossum, iritkatriel
2022-03-07 17:05:33JelleZijlstrasetmessageid: <1646672733.16.0.448459715427.issue46949@roundup.psfhosted.org>
2022-03-07 17:05:33JelleZijlstralinkissue46949 messages
2022-03-07 17:05:33JelleZijlstracreate