This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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 2022-04-11 14:58 by admin.

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
2022-04-11 14:58:30adminsetgithub: 71077
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