From 4119720f69883cbfb2a7d12b7b9ae67f6e758ae7 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 21 Apr 2023 21:46:08 -0400 Subject: [PATCH 1/3] Resolve the located directory and remove suppression of Exceptions. Ref python/cpython#103661. --- importlib_metadata/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/importlib_metadata/__init__.py b/importlib_metadata/__init__.py index e9ae0d19..3c4e0a25 100644 --- a/importlib_metadata/__init__.py +++ b/importlib_metadata/__init__.py @@ -536,12 +536,12 @@ def _read_files_egginfo_installed(self): subdir = getattr(self, '_path', None) if not text or not subdir: return - with contextlib.suppress(Exception): - ret = [ - str((subdir / line).resolve().relative_to(self.locate_file(''))) - for line in text.splitlines() - ] - return map('"{}"'.format, ret) + + ret = [ + str((subdir / line).resolve().relative_to(self.locate_file('').resolve())) + for line in text.splitlines() + ] + return map('"{}"'.format, ret) def _read_files_egginfo_sources(self): """ From ac0df0d7565d781a157e1517cea6aa3d30c3beec Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 21 Apr 2023 21:57:36 -0400 Subject: [PATCH 2/3] Wrap 'subdir/line' in PosixPath to ensure the output uses posix path separators. Ref python/cpython#103661. --- importlib_metadata/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/importlib_metadata/__init__.py b/importlib_metadata/__init__.py index 3c4e0a25..410e7a76 100644 --- a/importlib_metadata/__init__.py +++ b/importlib_metadata/__init__.py @@ -538,7 +538,10 @@ def _read_files_egginfo_installed(self): return ret = [ - str((subdir / line).resolve().relative_to(self.locate_file('').resolve())) + (subdir / line) + .resolve() + .relative_to(self.locate_file('').resolve()) + .as_posix() for line in text.splitlines() ] return map('"{}"'.format, ret) From be58651120fb65d0fadf93dcc5f609b300968704 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 21 Apr 2023 22:30:32 -0400 Subject: [PATCH 3/3] Update changelog --- CHANGES.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index bd9cd385..bed2dd99 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,10 @@ +v6.5.1 +====== + +* python/cpython#103661: Removed excess error suppression in + ``_read_files_egginfo_installed`` and fixed path handling + on Windows. + v6.5.0 ======