| 1 |
From: "Miss Islington (bot)" |
| 2 |
<[email protected]> |
| 3 |
Date: Wed, 4 Mar 2026 21:17:04 +0100 |
| 4 |
Subject: gh-145506: Fixes CVE-2026-2297 by ensuring SourcelessFileLoader uses |
| 5 |
io.open_code (GH-145507) |
| 6 |
|
| 7 |
(cherry picked from commit a51b1b512de1d56b3714b65628a2eae2b07e535e) |
| 8 |
|
| 9 |
Co-authored-by: Steve Dower <[email protected]> |
| 10 |
|
| 11 |
Origin: cpython, https://github.com/python/cpython/commit/482d6f8bdba9da3725d272e8bb4a2d25fb6a603e |
| 12 |
--- |
| 13 |
lib-python/3/importlib/_bootstrap_external.py | 2 +- |
| 14 |
1 file changed, 1 insertion(+), 1 deletion(-) |
| 15 |
|
| 16 |
diff --git a/lib-python/3/importlib/_bootstrap_external.py b/lib-python/3/importlib/_bootstrap_external.py |
| 17 |
index 0bfe7b6..48b68d7 100644 |
| 18 |
--- a/lib-python/3/importlib/_bootstrap_external.py |
| 19 |
+++ b/lib-python/3/importlib/_bootstrap_external.py |
| 20 |
@@ -1141,7 +1141,7 @@ class FileLoader: |
| 21 |
|
| 22 |
def get_data(self, path): |
| 23 |
"""Return the data from path as raw bytes.""" |
| 24 |
- if isinstance(self, (SourceLoader, ExtensionFileLoader)): |
| 25 |
+ if isinstance(self, (SourceLoader, SourcelessFileLoader, ExtensionFileLoader)): |
| 26 |
with _io.open_code(str(path)) as file: |
| 27 |
return file.read() |
| 28 |
else: |