Skip to content

Commit 4cdf146

Browse files
committed
Fix crashes with higher verbosity levels
This was causing issues in running the test suite locally at higher verbosity levels, since this block causes errors when passed a URL.
1 parent 8ef91cf commit 4cdf146

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/pip/_internal/index/package_finder.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
from pip._internal.utils.misc import build_netloc
3838
from pip._internal.utils.packaging import check_requires_python
3939
from pip._internal.utils.unpacking import SUPPORTED_EXTENSIONS
40-
from pip._internal.utils.urls import url_to_path
4140

4241
__all__ = ["FormatControl", "BestCandidateResult", "PackageFinder"]
4342

@@ -816,7 +815,14 @@ def find_all_candidates(self, project_name: str) -> List[InstallationCandidate]:
816815
)
817816

818817
if logger.isEnabledFor(logging.DEBUG) and file_candidates:
819-
paths = [url_to_path(c.link.url) for c in file_candidates]
818+
paths = []
819+
for candidate in file_candidates:
820+
assert candidate.link.url # we need to have a URL
821+
try:
822+
paths.append(candidate.link.file_path)
823+
except Exception:
824+
paths.append(candidate.link.url) # it's not a local file
825+
820826
logger.debug("Local files found: %s", ", ".join(paths))
821827

822828
# This is an intentional priority ordering

0 commit comments

Comments
 (0)