Skip to content

Commit

Permalink
fix: crash issue when dependencies are requested out of python range (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
frostming authored Aug 9, 2023
1 parent a6bcdf0 commit c2af2b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/2175.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug that dependencies requested out of the range of `requires-python` cause PDM to crash.
6 changes: 5 additions & 1 deletion src/pdm/resolver/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,11 @@ def get_dependencies(self, candidate: Candidate) -> list[Requirement]:
# requires-python=">=2.7". But it is eligible if A has environment marker
# A1; python_version>='3.8'
new_requires_python = candidate.req.requires_python & self.repository.environment.python_requires
if candidate.identify() not in self.overrides and not requires_python.is_superset(new_requires_python):
if not (
candidate.identify() in self.overrides
or new_requires_python.is_impossible
or requires_python.is_superset(new_requires_python)
):
valid_deps.append(PythonRequirement.from_pyspec_set(requires_python))
return valid_deps

Expand Down

0 comments on commit c2af2b2

Please sign in to comment.