Skip to content

Commit 876858c

Browse files
miss-islingtonzoobaStanFromIreland
authored
[3.10] gh-145506: Fixes CVE-2026-2297 by ensuring SourcelessFileLoader uses io.open_code (GH-145507) (#145516)
* 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> * Regenerate importlib_external.h * Fix blurb entry The `:cve:` role is not available on this branch. --------- Co-authored-by: Steve Dower <steve.dower@python.org> Co-authored-by: Stan Ulbrych <stan@ulbrych.org> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
1 parent 47128e6 commit 876858c

3 files changed

Lines changed: 1202 additions & 1199 deletions

File tree

Lib/importlib/_bootstrap_external.py

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

10701070
def get_data(self, path):
10711071
"""Return the data from path as raw bytes."""
1072-
if isinstance(self, (SourceLoader, ExtensionFileLoader)):
1072+
if isinstance(self, (SourceLoader, SourcelessFileLoader, ExtensionFileLoader)):
10731073
with _io.open_code(str(path)) as file:
10741074
return file.read()
10751075
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)