Message153345
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. |
|
Date |
User |
Action |
Args |
2012-02-14 16:01:49 | Jim.Jewett | set | recipients:
+ Jim.Jewett, loewis, ncoghlan, jjconti, ezio.melotti, eric.araujo, ubershmekel, chortos, dmascialino, eric.snow |
2012-02-14 16:01:48 | Jim.Jewett | set | messageid: <1329235308.92.0.860889485349.issue8087@psf.upfronthosting.co.za> |
2012-02-14 16:01:47 | Jim.Jewett | link | issue8087 messages |
2012-02-14 16:01:47 | Jim.Jewett | create | |
|