Skip to content

Commit f18552a

Browse files
committed
fix infinite loop for resolvable conflicts.
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>
1 parent 7b66e2d commit f18552a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/resolvelib/resolvers.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,13 @@ def resolve(self, requirements, max_rounds):
412412
# Dead ends everywhere. Give up.
413413
if not success:
414414
raise ResolutionImpossible(self.state.backtrack_causes)
415+
else:
416+
criterion = self.state.criteria[name]
417+
# Put newly-pinned candidate at the end. This is essential because
418+
# backtracking looks at this mapping to get the last pin.
419+
for candidate in criterion.candidates:
420+
self.state.mapping.pop(name, None)
421+
self.state.mapping[name] = candidate
415422
else:
416423
# discard as information sources any invalidated names
417424
# (unsatisfied names that were previously satisfied)

0 commit comments

Comments
 (0)