Bugs item #1218234, was opened at 2005-06-10 15:49 Message generated for change (Comment added) made by birkenfeld You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1218234&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.5 Status: Open Resolution: None Priority: 5 Submitted By: Björn Lindqvist (sonderblade) Assigned to: Nobody/Anonymous (nobody) Summary: inspect.getsource doesn't update when a module is reloaded Initial Comment: This is test.py: def foo(): print "Bla" And in an interactive session: >>> import inspect, test >>> test.foo() Bla >>> inspect.getsource(test.foo) 'def foo():\n print "Bla"\n' Now I edit test.py to (without exiting the interactive session): def foo(): print "Oh no!" >>> reload(test) <module 'test' from 'test.py'> >>> test.foo() Oh no! >>> inspect.getsource(test.foo) 'def foo():\n print "Bla"\n' inspect should output the new source. ---------------------------------------------------------------------- >Comment By: Reinhold Birkenfeld (birkenfeld) Date: 2005-06-10 18:36 Message: Logged In: YES user_id=1188172 This is the fault of the linecache module which inspect uses. It caches the file contents and does not reload it accordingly. However, I assume it's pretty hard finding a good solution to this. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1218234&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com