Issue 993580: inspect.findsource does not call linecache.checkcache (original) (raw)

Created on 2004-07-19 04:45 by jmobarak, last changed 2022-04-11 14:56 by admin. 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
2022-04-11 14:56:05 admin set github: 40593
2009-04-05 18:16:38 georg.brandl set status: open -> closeddependencies: - inspect.getsource doesn't update when a module is reloadedsuperseder: inspect.getsource doesn't update when a module is reloadednosy: + georg.brandlmessages: + resolution: duplicate
2009-03-04 15:13:21 ajaksu2 set nosy: + ajaksu2dependencies: + inspect.getsource doesn't update when a module is reloadedmessages: +
2009-02-14 14:46:31 ajaksu2 set stage: test neededtype: enhancementversions: + Python 2.7, - Python 2.3
2004-07-19 04:45:24 jmobarak create