Jim Jewett <jimjjew...@gmail.com> added the comment: Martin v. Löwis (loewis) wrote:
> Displaying a warning whenever the code has changed on disk is > clearly unacceptable As clarified, the request is only for when a traceback is being created (or perhaps even only for when one is being printed). I agree that we don't want to watch every file every time any code is run, but by the time a traceback is being displayed, any tight loops are ending. Nick Coghlan (ncoghlan) wrote: > There are a few different cases: ... > 2. Source has been changed, but module has not been reloaded ... > 3. Source has been changed, module has been reloaded, but object ... Given that a traceback is being displayed, I think it is reasonable to rerun the find-module portion of import, and verify that there is not stale byte-code. Frankly, I think it would be worth storing a file timestamp on modules, and verifying that whatever-would-be-imported-if-imported-now matches that timestamp. This would also catch case (3). I also think that -- on traceback display -- it might be worth verifying that the code's __globals__ is the __globals__ associated with the module of that name in sys.modules. This would warn about some intentional manipulations, but would catch case (3) even more accurately. ---------- nosy: +Jim.Jewett _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8087> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com