classification
Title: inspect.getsource gets source copy on disk even when module has not been reloaded
Type: Stage:
Components: Library (Lib) Versions: Python 3.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: emilyemorehouse, sebastien.bourdeauducq, yselivanov
Priority: normal Keywords:

Created on 2016-04-30 03:33 by sebastien.bourdeauducq, last changed 2017-02-21 16:37 by emilyemorehouse.

Messages (2)
msg264538 - (view) Author: Sebastien Bourdeauducq (sebastien.bourdeauducq) * Date: 2016-04-30 03:33
The fix of https://bugs.python.org/issue1218234 is a bit zealous. If the module has not been reloaded, e.g. calling a function will execute code older than what inspect.getsource returns.
msg264539 - (view) Author: Sebastien Bourdeauducq (sebastien.bourdeauducq) * Date: 2016-04-30 03:45
And since the import statement does not touch linecache, there are many other cases where inspect.getsource and objects can be out of sync.
History
Date User Action Args
2017-02-21 16:37:00emilyemorehousesetnosy: + emilyemorehouse
2016-05-02 09:44:34SilentGhostsetnosy: + yselivanov
2016-04-30 03:45:04sebastien.bourdeauducqsetmessages: + msg264539
2016-04-30 03:33:07sebastien.bourdeauducqcreate