diff --git a/src/pip/_internal/resolution/resolvelib/provider.py b/src/pip/_internal/resolution/resolvelib/provider.py index fb0dd85f112..3c60f0e67cf 100644 --- a/src/pip/_internal/resolution/resolvelib/provider.py +++ b/src/pip/_internal/resolution/resolvelib/provider.py @@ -14,6 +14,8 @@ from pip._vendor.resolvelib.providers import AbstractProvider +from pip._internal.resolution.resolvelib.requirements import ExplicitRequirement + from .base import Candidate, Constraint, Requirement from .candidates import REQUIRES_PYTHON_IDENTIFIER from .factory import Factory @@ -146,7 +148,7 @@ def get_preference( lookups = (r.get_candidate_lookup() for r, _ in information[identifier]) candidate, ireqs = zip(*lookups) else: - candidate, ireqs = None, () + candidate, ireqs = (None,), () operators = [ specifier.operator @@ -154,7 +156,7 @@ def get_preference( for specifier in specifier_set ] - direct = candidate is not None + direct = any(candidate) pinned = any(op[:2] == "==" for op in operators) unfree = bool(operators)