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 can't get source code if provided function isn't from a file
Type: behavior Stage: resolved
Components: Versions: Python 3.4
process
Status: closed Resolution: duplicate
Dependencies: Superseder: inspect.getsource only works for objects loaded from files, not interactive session
View: 12920
Assigned To: Nosy List: ned.deily, zorceta
Priority: normal Keywords:

Created on 2015-06-23 16:46 by zorceta, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg245694 - (view) Author: Zorceta (zorceta) Date: 2015-06-23 16:46
Both python.exe and IDLE can't. IPython is able to, as it inserts REPL input into linecache.
msg245715 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2015-06-24 04:04
Issue12920 is currently open with a suggestion to change the documentation for inspect.getsource.
History
Date User Action Args
2022-04-11 14:58:18adminsetgithub: 68679
2015-06-24 04:04:41ned.deilysetstatus: open -> closed

superseder: inspect.getsource only works for objects loaded from files, not interactive session

nosy: + ned.deily
messages: + msg245715
resolution: duplicate
stage: resolved
2015-06-23 16:46:56zorcetacreate