]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-151560: fix `AttributeError` when running `test.test_importlib.resources.test_reso...
authorU2A2U2A1 <192709584+ringobanana-3900@users.noreply.github.com>
Mon, 22 Jun 2026 14:17:26 +0000 (23:17 +0900)
committerGitHub <noreply@github.com>
Mon, 22 Jun 2026 14:17:26 +0000 (14:17 +0000)
* [gh-151560]
import MetaPathFinder, Loader from importlib.abc
+ make it used

* sort import alphabetically

Lib/test/test_importlib/resources/util.py

index 85b5c61518de444754b159c8119cfc8e29bfb6bc..e734746e9dcb3b82bbd72246a9703db85e1b7431 100644 (file)
@@ -6,6 +6,7 @@ import io
 import pathlib
 import sys
 import types
+from importlib.abc import Loader, MetaPathFinder
 from importlib.machinery import ModuleSpec
 from importlib.resources.abc import ResourceReader, Traversable, TraversableResources
 
@@ -218,7 +219,7 @@ class MemorySetup(ModuleSetup):
         yield
         sys.meta_path.remove(finder_instance)
 
-    class MemoryFinder(importlib.abc.MetaPathFinder):
+    class MemoryFinder(MetaPathFinder):
         def __init__(self, module):
             self._module = module
 
@@ -232,7 +233,7 @@ class MemorySetup(ModuleSetup):
                 is_package=True,
             )
 
-    class MemoryLoader(importlib.abc.Loader):
+    class MemoryLoader(Loader):
         def __init__(self, module):
             self._module = module