[New-bugs-announce] [issue23594] Wrong variable name in traceback

Jeff Zemla report at bugs.python.org
Thu Mar 5 23:09:02 CET 2015


New submission from Jeff Zemla:

I've found a rather simple bug in the default CPython implementation on Mac OS X 10.9.5

1) Create a new .py file containing:

def a():
    print q

x=5


2) Open Python and run using execfile() then a(). Receive error as expected:

  File "test.py", line 2, in a
    print q
NameError: global name 'q' is not defined

3) Edit file so that "print q" is not "print x", and save.

4) Run a() (Do not use execfile!)

5) Error:

  File "test.py", line 2, in a
    print x
NameError: global name 'q' is not defined

EXPECTED: Traceback should say "print q" NOT "print x". It is reading from the file. Actually, the error in the file has been corrected-- it is the copy of the program in memory that is faulty.


Python 2.7.5 (default, Mar  9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin

----------
components: Macintosh
messages: 237293
nosy: Jeff Zemla, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: Wrong variable name in traceback
type: compile error
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23594>
_______________________________________


More information about the New-bugs-announce mailing list