summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2020-06-14 08:12:20 -0400
committerGitHub <noreply@github.com>2020-06-14 14:12:20 +0200
commit8a3469047c3c7b68f434ed244ef3ae4292dd8cbc (patch)
tree429e44857f3333f68d06d0d72c176eddf3319e22 /Lib
parent83cd968f5cc59ad60b665080087f50fefac17a07 (diff)
downloadcpython-git-8a3469047c3c7b68f434ed244ef3ae4292dd8cbc.tar.gz
[3.9] bpo-40924: Remove protocol for supplying Traversable objects from loaders (GH-20820)
Remove protocol that loaders can present a files method as found in importlib_resources 1.3-1.6 (added in Python 3.8b1).
Diffstat (limited to 'Lib')
-rw-r--r--Lib/importlib/_common.py12
1 files changed, 1 insertions, 11 deletions
diff --git a/Lib/importlib/_common.py b/Lib/importlib/_common.py
index ba7cbac3c9..c1204f0b8f 100644
--- a/Lib/importlib/_common.py
+++ b/Lib/importlib/_common.py
@@ -11,17 +11,7 @@ def from_package(package):
Return a Traversable object for the given package.
"""
- spec = package.__spec__
- return from_traversable_resources(spec) or fallback_resources(spec)
-
-
-def from_traversable_resources(spec):
- """
- If the spec.loader implements TraversableResources,
- directly or implicitly, it will have a ``files()`` method.
- """
- with contextlib.suppress(AttributeError):
- return spec.loader.files()
+ return fallback_resources(package.__spec__)
def fallback_resources(spec):