Skip to content

Commit 69ddd9b

Browse files
[3.11] gh-145506: Fixes CVE-2026-2297 by ensuring SourcelessFileLoader uses io.open_code (GH-145507) (#145515)
* gh-145506: Fixes CVE-2026-2297 by ensuring SourcelessFileLoader uses io.open_code (GH-145507) (cherry picked from commit a51b1b5) Co-authored-by: Steve Dower <steve.dower@python.org> * Fix docs reference --------- Co-authored-by: Steve Dower <steve.dower@python.org>
1 parent e20c6c9 commit 69ddd9b

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

Lib/importlib/_bootstrap_external.py

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

11271127
def get_data(self, path):
11281128
"""Return the data from path as raw bytes."""
1129-
if isinstance(self, (SourceLoader, ExtensionFileLoader)):
1129+
if isinstance(self, (SourceLoader, SourcelessFileLoader, ExtensionFileLoader)):
11301130
with _io.open_code(str(path)) as file:
11311131
return file.read()
11321132
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)