Author Naftali.Harris
Recipients Naftali.Harris, benjamin.peterson, kbk
Date 2016-12-29.18:23:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1483035828.75.0.241561980745.issue29107@psf.upfronthosting.co.za>
In-reply-to
Content
The traceback documentation states that it "exactly mimics the behavior of the Python interpreter when it prints a stack trace." Here's a small case where it doesn't, on 2.7.13:

~/repos/Python-2.7.13$ cat example.py
def f(x):
    global x
~/repos/Python-2.7.13$ ./python.exe
Python 2.7.13 (default, Dec 29 2016, 09:54:42)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import traceback
>>> import example
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "example.py", line 1
    def f(x):
SyntaxError: name 'x' is local and global
>>> try:
... 	import example
... except:
... 	traceback.print_exc()
...
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
SyntaxError: name 'x' is local and global (example.py, line 1)
>>>

I believe Kurt fixed this for Python 3000 with https://mail.python.org/pipermail/python-3000-checkins/2007-July/001259.html
History
Date User Action Args
2016-12-29 18:23:48Naftali.Harrissetrecipients: + Naftali.Harris, kbk, benjamin.peterson
2016-12-29 18:23:48Naftali.Harrissetmessageid: <1483035828.75.0.241561980745.issue29107@psf.upfronthosting.co.za>
2016-12-29 18:23:48Naftali.Harrislinkissue29107 messages
2016-12-29 18:23:48Naftali.Harriscreate