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.

classification
Title: Wrong variable name in traceback
Type: compile error Stage: resolved
Components: macOS Versions: Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Unupdated source file in traceback
View: 8087
Assigned To: Nosy List: Jeff Zemla, ezio.melotti, ned.deily, python-dev, r.david.murray, ronaldoussoren
Priority: normal Keywords:

Created on 2015-03-05 22:09 by Jeff Zemla, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (4)
msg237293 - (view) Author: Jeff Zemla (Jeff Zemla) Date: 2015-03-05 22:09
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
msg237294 - (view) Author: Jeff Zemla (Jeff Zemla) Date: 2015-03-05 22:10
In 3), "not" should be "now"
msg237295 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-03-05 22:13
This is a duplicate of an existing issue but I don't have time to find the issue.  It's not a trivial problem to fix, though now that the import system is in python it may be possible.
msg237296 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2015-03-05 22:15
#8087
History
Date User Action Args
2022-04-11 14:58:13adminsetgithub: 67782
2015-03-06 01:38:22ned.deilysetmessages: - msg237316
2015-03-06 01:37:42python-devsetnosy: + python-dev
messages: + msg237316
2015-03-05 22:30:08ned.deilysetstatus: open -> closed
superseder: Unupdated source file in traceback
resolution: duplicate
stage: resolved
2015-03-05 22:15:27ezio.melottisetnosy: + ezio.melotti
messages: + msg237296
2015-03-05 22:13:48r.david.murraysetnosy: + r.david.murray
messages: + msg237295
2015-03-05 22:10:22Jeff Zemlasetmessages: + msg237294
2015-03-05 22:09:02Jeff Zemlacreate