From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Thu, 16 Jan 2025 09:09:13 +0000 (+0100) Subject: [3.12] gh-128816: Fix warnings in test_doctest (GH-128817) (GH-128871) X-Git-Tag: v3.12.9~72 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=45b89bf0da69a1193e5c79029a118763512a1d04;p=thirdparty%2FPython%2Fcpython.git [3.12] gh-128816: Fix warnings in test_doctest (GH-128817) (GH-128871) * Fix a deprecation warning for using importlib.resources.abc.ResourceReader. * Fix an import warning when importing readline (if it has not yet been imported). (cherry picked from commit 599be687ec7327c30c6469cf743aa4ee9e82232d) Co-authored-by: Thomas Grainger --- diff --git a/Lib/test/test_doctest/test_doctest.py b/Lib/test/test_doctest/test_doctest.py index 069418453f1f..62d474633a62 100644 --- a/Lib/test/test_doctest/test_doctest.py +++ b/Lib/test/test_doctest/test_doctest.py @@ -2780,7 +2780,7 @@ Test the verbose output: >>> sys.argv = save_argv """ -class TestImporter(importlib.abc.MetaPathFinder, importlib.abc.ResourceLoader): +class TestImporter(importlib.abc.MetaPathFinder): def find_spec(self, fullname, path, target=None): return importlib.util.spec_from_file_location(fullname, path, loader=self) @@ -2789,6 +2789,12 @@ class TestImporter(importlib.abc.MetaPathFinder, importlib.abc.ResourceLoader): with open(path, mode='rb') as f: return f.read() + def exec_module(self, module): + raise ImportError + + def create_module(self, spec): + return None + class TestHook: def __init__(self, pathdir):