From: U2A2U2A1 <192709584+ringobanana-3900@users.noreply.github.com> Date: Mon, 22 Jun 2026 14:17:26 +0000 (+0900) Subject: gh-151560: fix `AttributeError` when running `test.test_importlib.resources.test_reso... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b8786dc33b634946e5a295323e8cbc693e565ff8;p=thirdparty%2FPython%2Fcpython.git gh-151560: fix `AttributeError` when running `test.test_importlib.resources.test_resource` (#151561) * [gh-151560] import MetaPathFinder, Loader from importlib.abc + make it used * sort import alphabetically --- diff --git a/Lib/test/test_importlib/resources/util.py b/Lib/test/test_importlib/resources/util.py index 85b5c61518de..e734746e9dcb 100644 --- a/Lib/test/test_importlib/resources/util.py +++ b/Lib/test/test_importlib/resources/util.py @@ -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