sys.tracebacklimit

Chris Rebert clp2 at rebertia.com
Wed Jul 13 13:10:45 EDT 2011


On Wed, Jul 13, 2011 at 6:42 AM, Vlad Didenko <vdidenko at getcollc.com> wrote:
> Colleagues,
> Per documentation
> at http://docs.python.org/py3k/library/sys.html#sys.tracebacklimit :
>      When [sys.tracebacklimit] set to 0 or less, all traceback information
> is suppressed and only the exception type and value are printed
> So, I expect to be able to have a program like:
>     import sys
>     sys.tracebacklimit=0
>     print(1/0)
> And see it's result as:
>      ZeroDivisionError: division by zero
> However, the actual result is:
>      Traceback (most recent call last):
>        File "tbt.py", line 3, in <module>
>          print(1/0)
>      ZeroDivisionError: division by zero
> Do I misunderstand the docs?

Nope. It's a known bug:
http://bugs.python.org/issue12276

Cheers,
Chris



More information about the Python-list mailing list