[issue1218234] inspect.getsource doesn't update when a module is reloaded

Jean-Paul Calderone report at bugs.python.org
Fri Jul 16 15:32:01 CEST 2010


Jean-Paul Calderone <exarkun at twistedmatrix.com> added the comment:

> linecache.checkcache does a stat() of every single cached file.

Ah, sorry.  I didn't read carefully enough.  I see that the patch passes in the filename and checkcache restricts the work it does in that case.

Something else to consider, though, is that this change means you'll also get the new source if you *don't* reload the module, too.  So, what exactly is inspect.getsource() supposed to be doing?  Giving you the current on-disk contents of the relevant source file?  Or giving you the actual source corresponding to the object passed to it?

If the latter, then this actually needs to be more tightly integrated with module reloading somehow.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1218234>
_______________________________________


More information about the Python-bugs-list mailing list