mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.14] gh-140228: Avoid making unnecessary syscalls in linecache for frozen modules (GH-140377) (#140738)
gh-140228: Avoid making unnecessary syscalls in linecache for frozen modules (GH-140377)
(cherry picked from commit c41f84ff61)
Co-authored-by: tconley1428 <tconley1428@gmail.com>
This commit is contained in:
parent
c45ab05a3a
commit
6d0e1c8478
2 changed files with 5 additions and 1 deletions
|
|
@ -131,9 +131,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