Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix infinite loop for resolvable conflicts.
Browse files Browse the repository at this point in the history
The dependency resolution might enter in an infinite loop if there are
dependency conflicts, even though they can be resolved.
The issue arises because a package causing the dependency conflict is
not removed from the list of unsatisfied names, even if the resolution
is successful, causing it's dependencies to be processed over and over.

This change can be tested with the following requirements:
```
boto3==1.10.16
s3fs
seaborn
```

Signed-off-by: Stefano Bennati <stefano.bennati@here.com>
bennati committed Dec 23, 2022
1 parent 7b66e2d commit f18552a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/resolvelib/resolvers.py
Original file line number Diff line number Diff line change
@@ -412,6 +412,13 @@ def resolve(self, requirements, max_rounds):
# Dead ends everywhere. Give up.
if not success:
raise ResolutionImpossible(self.state.backtrack_causes)
else:
criterion = self.state.criteria[name]
# Put newly-pinned candidate at the end. This is essential because
# backtracking looks at this mapping to get the last pin.
for candidate in criterion.candidates:
self.state.mapping.pop(name, None)
self.state.mapping[name] = candidate
else:
# discard as information sources any invalidated names
# (unsatisfied names that were previously satisfied)

0 comments on commit f18552a

Please sign in to comment.