[New-bugs-announce] [issue14008] Python uses the new source when reporting an old exception

Yuval Greenfield report at bugs.python.org
Tue Feb 14 12:38:59 CET 2012


New submission from Yuval Greenfield <ubershmekel at gmail.com>:

I ran the following code:

    import time
    time.sleep(10)
    print 1 / 0


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


    e:\Dropbox\dev\python\metricbot>c:\python32\python test.py
    Traceback (most recent call last):
      File "test.py", line 3, in <module>
        alkdf;alsdkf;l
    ZeroDivisionError: division by zero


What should have been printed out:

    e:\Dropbox\dev\python\metricbot>test.py
    Traceback (most recent call last):
      File "E:\Dropbox\dev\python\metricbot\test.py", 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.

----------
components: Interpreter Core
messages: 153337
nosy: ubershmekel
priority: normal
severity: normal
status: open
title: Python uses the new source when reporting an old exception
type: behavior
versions: Python 3.3

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


More information about the New-bugs-announce mailing list