summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2021-11-09 18:49:43 -0500
committerJason R. Coombs <jaraco@jaraco.com>2021-11-09 18:57:50 -0500
commitf8d2762603fe8ea46e6c18720e9ebed27a5529fe (patch)
treed50ebf03923f3f5585fcc51c9f8ad6ffe51f6123
parent4d1cdd7006def053c815c354bd6f266b4850bd97 (diff)
downloadcpython-git-backport-6ec0dec-3.9.tar.gz
[3.9] [bpo-45765] Fix distribution discovery on empty path. (GH-29487).backport-6ec0dec-3.9
(cherry picked from commit 6ec0dec7b7b50d4fee5b2b66cf38e4291bcdf44c) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
-rw-r--r--Lib/importlib/metadata.py2
-rw-r--r--Misc/NEWS.d/next/Library/2021-11-09-09-04-19.bpo-45765.JVobxK.rst1
2 files changed, 2 insertions, 1 deletions
diff --git a/Lib/importlib/metadata.py b/Lib/importlib/metadata.py
index ffa0cba457..c6c7d31aa5 100644
--- a/Lib/importlib/metadata.py
+++ b/Lib/importlib/metadata.py
@@ -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
index 0000000000..a1f4a1f7aa
--- /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.