mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-140228: Avoid making unnecessary syscalls in linecache for frozen modules (#140377)
This commit is contained in:
parent
ce4b0ede16
commit
c41f84ff61
2 changed files with 5 additions and 1 deletions
|
|
@ -123,9 +123,12 @@ def updatecache(filename, module_globals=None):
|
||||||
if _source_unavailable(filename):
|
if _source_unavailable(filename):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
if filename.startswith('<frozen ') and module_globals is not None:
|
if filename.startswith('<frozen '):
|
||||||
# This is a frozen module, so we need to use the filename
|
# This is a frozen module, so we need to use the filename
|
||||||
# from the module globals.
|
# from the module globals.
|
||||||
|
if module_globals is None:
|
||||||
|
return []
|
||||||
|
|
||||||
fullname = module_globals.get('__file__')
|
fullname = module_globals.get('__file__')
|
||||||
if fullname is None:
|
if fullname is None:
|
||||||
return []
|
return []
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
Avoid making unnecessary filesystem calls for frozen modules in :mod:`linecache` when the global module cache is not present.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue