Jonathan Fine <jfine2...@gmail.com> added the comment:

The problem, as I understand it, is a mismatch between the code object being 
executed and the file on disk referred to by the code object. When a module is 
reloaded it is first recompiled, if the .py file is newer than the .pyc file. 
(I've tested this at a console.)

Suppose wibble.py contains a function fn. Now do
   import wibble
   fn = wibble.fn
   # Modify and save wibble.py
   reload(wibble)
   fn()

It seems to me that
1) We have a mismatch between fn (in module __main__) and the file on disk.
2) Comparison will show that wibble.pyc is later than wibble.py.
3) There's no reliable way to discover that fn is not the current fn  ...
4) ... other than comparing its bytecode with that of the current value of 
wibble.fn.

Regarding (4) there might be another method. But I can't think of one that's 
reliable.

----------
nosy: +jfine2358

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35857>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to