classification
Title: inspect.findsource does not call linecache.checkcache
Type: enhancement Stage: test needed
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: inspect.getsource doesn't update when a module is reloaded
View: 1218234
Assigned To: Nosy List: ajaksu2, georg.brandl, jlcherry, jmobarak
Priority: normal Keywords:

Created on 2004-07-19 04:45 by jmobarak, last changed 2009-04-05 18:16 by georg.brandl. This issue is now closed.

Files
File name Uploaded Description Edit
inspect-bug.py jmobarak, 2004-07-19 04:45
Messages (6)
msg21679 - (view) Author: Jason Mobarak (jmobarak) Date: 2004-07-19 04:45
inspect.findsource does not call linecache.checkcache
thus always returns orignal source of an object
regardless of wether it has changed.

msg21680 - (view) Author: Jason Mobarak (jmobarak) Date: 2004-07-19 04:53
Logged In: YES 
user_id=1041478

Actually, I'm not sure if this is really a bug, seems to
make sense that inspect shouldn't return the new source of
the object unless the object has changed.
msg21681 - (view) Author: Jason Mobarak (jmobarak) Date: 2004-07-19 05:01
Logged In: YES 
user_id=1041478

Not to mention there's intermediate steps where an object's
source could change several times, and be reloaded at one of
those intermediate steps... seems like there's no way for
findsource itself to return the correct source for an object
if it's reloaded. Maybe this should be documented...
msg21682 - (view) Author: Josh Cherry (jlcherry) Date: 2005-03-20 15:20
Logged In: YES 
user_id=957678

Note that if you tack on

execfile(somefile)
print inspect.findsource(foo)

at the end of the example, so that the object does change, 
you still see the old source.
msg83124 - (view) Author: Daniel Diniz (ajaksu2) (Python triager) Date: 2009-03-04 15:13
Issue 1218234 has a patch.
msg85540 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-04-05 18:16
Setting it as a superseder, then.
History
Date User Action Args
2009-04-05 18:16:38georg.brandlsetstatus: open -> closed

dependencies: - inspect.getsource doesn't update when a module is reloaded
superseder: inspect.getsource doesn't update when a module is reloaded

nosy: + georg.brandl
messages: + msg85540
resolution: duplicate
2009-03-04 15:13:21ajaksu2setnosy: + ajaksu2
dependencies: + inspect.getsource doesn't update when a module is reloaded
messages: + msg83124
2009-02-14 14:46:31ajaksu2setstage: test needed
type: enhancement
versions: + Python 2.7, - Python 2.3
2004-07-19 04:45:24jmobarakcreate