Skip to content

Commit 573c345

Browse files
zoobastratakis
authored andcommitted
Logging Bypass in Legacy .pyc File Handling
1 parent 13fef9b commit 573c345

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Lib/importlib/_bootstrap_external.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,7 @@ def get_filename(self, fullname):
11861186

11871187
def get_data(self, path):
11881188
"""Return the data from path as raw bytes."""
1189-
if isinstance(self, (SourceLoader, ExtensionFileLoader)):
1189+
if isinstance(self, (SourceLoader, SourcelessFileLoader, ExtensionFileLoader)):
11901190
with _io.open_code(str(path)) as file:
11911191
return file.read()
11921192
else:
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fixes :cve:`2026-2297` by ensuring that ``SourcelessFileLoader`` uses
2+
:func:`io.open_code` when opening ``.pyc`` files.

0 commit comments

Comments
 (0)