Skip to content

Commit cb54084

Browse files
committed
Skip reading source lines if filename is _pyrepl.__main__ inside REPL
1 parent ed6934e commit cb54084

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Lib/linecache.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ def lazycache(filename, module_globals):
182182
if module_globals and '__name__' in module_globals:
183183
spec = module_globals.get('__spec__')
184184
name = getattr(spec, 'name', None) or module_globals['__name__']
185+
if name == "_pyrepl.__main__":
186+
return False
185187
loader = getattr(spec, 'loader', None)
186188
if loader is None:
187189
loader = module_globals.get('__loader__')

0 commit comments

Comments
 (0)