[Python-checkins] [bpo-45765] Fix distribution discovery on empty path. (GH-29487) (GH-29510)

jaraco webhook-mailer at python.org
Sat Nov 13 15:08:32 EST 2021


https://github.com/python/cpython/commit/ed55426acd58f030ccc0cf1297e66078f538797c
commit: ed55426acd58f030ccc0cf1297e66078f538797c
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: jaraco <jaraco at jaraco.com>
date: 2021-11-13T15:08:28-05:00
summary:

[bpo-45765] Fix distribution discovery on empty path. (GH-29487) (GH-29510)

(cherry picked from commit 6ec0dec7b7b50d4fee5b2b66cf38e4291bcdf44c)

Co-authored-by: Jason R. Coombs <jaraco at jaraco.com>

Co-authored-by: Jason R. Coombs <jaraco at jaraco.com>

files:
A Misc/NEWS.d/next/Library/2021-11-09-09-04-19.bpo-45765.JVobxK.rst
M Lib/importlib/metadata/__init__.py

diff --git a/Lib/importlib/metadata/__init__.py b/Lib/importlib/metadata/__init__.py
index f5172eefc1841..b3e8fb05f1d98 100644
--- a/Lib/importlib/metadata/__init__.py
+++ b/Lib/importlib/metadata/__init__.py
@@ -748,7 +748,7 @@ def joinpath(self, child):
 
     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
index 0000000000000..a1f4a1f7aa91c
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2021-11-09-09-04-19.bpo-45765.JVobxK.rst
@@ -0,0 +1 @@
+In importlib.metadata, fix distribution discovery for an empty path.



More information about the Python-checkins mailing list