Skip to content

Commit 97d34e2

Browse files
committed
Try interning name and path eagerly
1 parent d60a6be commit 97d34e2

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

.github/workflows/reusable-windows.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ jobs:
4141
shell: bash
4242
- name: Display build info
4343
run: .\\python.bat -m test.pythoninfo
44-
- name: DO NOT MERGE cleanup pyc
45-
run: dir Lib/*.pyc -r | del
46-
shell: powershell
4744
- name: Tests
4845
run: >-
4946
.\\PCbuild\\rt.bat

Lib/importlib/_bootstrap_external.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -820,14 +820,11 @@ def get_code(self, fullname):
820820
source_hash = None
821821
hash_based = False
822822
check_source = True
823-
bytecode_path = None
824-
# TESTING: Potential fast path
825-
if sys.implementation.cache_tag is not None:
826-
try:
827-
bytecode_path = cache_from_source(source_path)
828-
except NotImplementedError:
829-
pass
830-
if bytecode_path:
823+
try:
824+
bytecode_path = cache_from_source(source_path)
825+
except NotImplementedError:
826+
bytecode_path = None
827+
else:
831828
try:
832829
st = self.path_stats(source_path)
833830
except OSError:
@@ -904,8 +901,8 @@ class FileLoader:
904901
def __init__(self, fullname, path):
905902
"""Cache the module name and the path to the file found by the
906903
finder."""
907-
self.name = fullname
908-
self.path = path
904+
self.name = sys.intern(fullname)
905+
self.path = sys.intern(path)
909906

910907
def __eq__(self, other):
911908
return (self.__class__ == other.__class__ and

0 commit comments

Comments
 (0)