]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[bpo-45765] Fix distribution discovery on empty path. (GH-29487) (GH-29510)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 13 Nov 2021 20:08:28 +0000 (12:08 -0800)
committerGitHub <noreply@github.com>
Sat, 13 Nov 2021 20:08:28 +0000 (15:08 -0500)
(cherry picked from commit 6ec0dec7b7b50d4fee5b2b66cf38e4291bcdf44c)

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

index f5172eefc184111414f4ec0c26d8f897e0fb105c..b3e8fb05f1d985cf7ad4a1f4645a91aaf00dac98 100644 (file)
@@ -748,7 +748,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.