Title: Python uses the new source when reporting an old exception
Type: behavior Stage:
Components: Interpreter Core Versions: Python 3.3
Status: closed Resolution: duplicate
Dependencies: Superseder: Unupdated source file in traceback
View: 8087
Assigned To: Nosy List: ubershmekel
Priority: normal Keywords:

Created on 2012-02-14 11:38 by ubershmekel, last changed 2012-02-14 13:17 by flox. This issue is now closed.

Messages (1)
msg153337 - (view) Author: Yuval Greenfield (ubershmekel) * Date: 2012-02-14 11:38
I ran the following code:

    import time
    print 1 / 0

And then modified the source before it hit the exception, python prints out the wrong lines from the new source file.

    Traceback (most recent call last):
      File "", line 3, in <module>
    ZeroDivisionError: division by zero

What should have been printed out:

    Traceback (most recent call last):
      File "E:\Dropbox\dev\python\metricbot\", line 3, in <module>
        print 1 / 0
    ZeroDivisionError: integer division or modulo by zero

Although this is a toy example, I did run in to the problem when working on a long running script that I was upgrading.

Tested it and got the same results on python 2.7 and 3.2.
Date User Action Args
2012-02-14 13:17:51floxsetstatus: open -> closed
resolution: duplicate
superseder: Unupdated source file in traceback
2012-02-14 11:38:58ubershmekelcreate