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

jaraco webhook-mailer at python.org
Sat Nov 13 15:07:31 EST 2021


https://github.com/python/cpython/commit/3e0b830e859ca8792401bfd1402d659f56f99941
commit: 3e0b830e859ca8792401bfd1402d659f56f99941
branch: 3.9
author: Jason R. Coombs <jaraco at jaraco.com>
committer: jaraco <jaraco at jaraco.com>
date: 2021-11-13T15:07:22-05:00
summary:

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

(cherry picked from commit 6ec0dec7b7b50d4fee5b2b66cf38e4291bcdf44c)

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.py

diff --git a/Lib/importlib/metadata.py b/Lib/importlib/metadata.py
index ffa0cba45706d..c6c7d31aa5d8a 100644
--- a/Lib/importlib/metadata.py
+++ b/Lib/importlib/metadata.py
@@ -419,7 +419,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