[issue35857] Stacktrace shows lines from updated file on disk, not code actually running

Stefan Behnel report at bugs.python.org
Wed Jan 30 12:35:49 EST 2019


Stefan Behnel <stefan_ml at behnel.de> added the comment:

I think the REPL could, when it formats a stack trace for printing, check every referenced source file if it's newer than its compiled .pyc (bytecode) file, and insert a warning into the stack trace if that is the case.

I don't see any use in doing this for all stack traces, so only ones that get printed out for the user could receive special treatment.

I also don't think we need to go further than that, e.g. check startup or module import time. Basically, whenever the source file is not in sync with the .pyc file, it's not unlikely that the code that is running corresponds to the .pyc file and no longer to the .py file.

Changing to target version to 3.8, since this is essentially a new feature and not acceptable as a bug fix for older versions.

----------
nosy: +scoder
type: behavior -> enhancement
versions: +Python 3.8 -Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35857>
_______________________________________


More information about the Python-bugs-list mailing list