Skip to content

Commit 45b89bf

Browse files
[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 599be68) Co-authored-by: Thomas Grainger <[email protected]>
1 parent 0308bcf commit 45b89bf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Diff for: Lib/test/test_doctest/test_doctest.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -2780,7 +2780,7 @@ def test_testfile(): r"""
27802780
>>> sys.argv = save_argv
27812781
"""
27822782

2783-
class TestImporter(importlib.abc.MetaPathFinder, importlib.abc.ResourceLoader):
2783+
class TestImporter(importlib.abc.MetaPathFinder):
27842784

27852785
def find_spec(self, fullname, path, target=None):
27862786
return importlib.util.spec_from_file_location(fullname, path, loader=self)
@@ -2789,6 +2789,12 @@ def get_data(self, path):
27892789
with open(path, mode='rb') as f:
27902790
return f.read()
27912791

2792+
def exec_module(self, module):
2793+
raise ImportError
2794+
2795+
def create_module(self, spec):
2796+
return None
2797+
27922798
class TestHook:
27932799

27942800
def __init__(self, pathdir):

0 commit comments

Comments
 (0)