mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-117174: Add a new route in linecache to fetch interactive source code (#117500)
This commit is contained in:
parent
ecdf6b15b0
commit
a931a8b324
16 changed files with 142 additions and 93 deletions
|
@ -969,6 +969,8 @@ def findsource(object):
|
|||
module = getmodule(object, file)
|
||||
if module:
|
||||
lines = linecache.getlines(file, module.__dict__)
|
||||
if not lines and file.startswith('<') and hasattr(object, "__code__"):
|
||||
lines = linecache._getlines_from_code(object.__code__)
|
||||
else:
|
||||
lines = linecache.getlines(file)
|
||||
if not lines:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue