]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.9] [bpo-45765] Fix distribution discovery on empty path. (GH-29487). (GH-29511)
authorJason R. Coombs <jaraco@jaraco.com>
Sat, 13 Nov 2021 20:07:22 +0000 (15:07 -0500)
committerGitHub <noreply@github.com>
Sat, 13 Nov 2021 20:07:22 +0000 (15:07 -0500)
(cherry picked from commit 6ec0dec7b7b50d4fee5b2b66cf38e4291bcdf44c)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Lib/importlib/metadata.py
Misc/NEWS.d/next/Library/2021-11-09-09-04-19.bpo-45765.JVobxK.rst [new file with mode: 0644]

index ffa0cba45706d6e77ffea484fc05ce2cfb405e67..c6c7d31aa5d8ae0bccfd571ac7a5e259d6d3b86e 100644 (file)
@@ -419,7 +419,7 @@ class FastPath:
 
     def children(self):
         with suppress(Exception):
-            return os.listdir(self.root or '')
+            return os.listdir(self.root or '.')
         with suppress(Exception):
             return self.zip_children()
         return []
diff --git a/Misc/NEWS.d/next/Library/2021-11-09-09-04-19.bpo-45765.JVobxK.rst b/Misc/NEWS.d/next/Library/2021-11-09-09-04-19.bpo-45765.JVobxK.rst
new file mode 100644 (file)
index 0000000..a1f4a1f
--- /dev/null
@@ -0,0 +1 @@
+In importlib.metadata, fix distribution discovery for an empty path.