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.

Title: Traceback prints different code than the running module
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.6
Status: closed Resolution: duplicate
Dependencies: Superseder: Unupdated source file in traceback
View: 8087
Assigned To: Nosy List: Aigars Mahinovs, r.david.murray
Priority: normal Keywords:

Created on 2017-08-29 11:03 by Aigars Mahinovs, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg300980 - (view) Author: Aigars Mahinovs (Aigars Mahinovs) Date: 2017-08-29 11:03
If you run a longer running Python program, then change the Python module that it loaded on disk and then cause a traceback to happen in the code in that module, then the traceback may be nonsensical as it will reference line numbers from the module in memory, but print code from the same line numbers from the file on disk, even if they are different.

In any case there should be a prominent warning on traceback if the module in memory does not match the module on disk, but ideally the traceback print should show the code in memory - the actual code that caused the problem.
msg300989 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2017-08-29 13:42
This is a duplicate of issue 8087, which contains quite a bit of discussion of the subtleties of the issue.
Date User Action Args
2022-04-11 14:58:51adminsetgithub: 75481
2017-08-29 13:42:20r.david.murraysetstatus: open -> closed

superseder: Unupdated source file in traceback

nosy: + r.david.murray
messages: + msg300989
resolution: duplicate
stage: resolved
2017-08-29 11:03:31Aigars Mahinovscreate