Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in version solver when using a hashable object to represent a package, not just a string. #14

Open
Greedquest opened this issue Apr 30, 2022 · 0 comments

Comments

@Greedquest
Copy link

Greedquest commented Apr 30, 2022

I believe it's this line:

changed.add(str(self._propagate_incompatibility(root_cause)))

self._propagate_incompatibility will return the _conflict type which is the hashable type used to represent a package (in my usecase this is not a string). The line converts it to str which is a problem since then it is no longer a valid key in the self._incompatibilities dictionary (line 113 of the same function).

def _propagate(self, package): # type: (Hashable) -> None
"""
Performs unit propagation on incompatibilities transitively
related to package to derive new assignments for _solution.
"""
changed = set()
changed.add(package)
while changed:
package = changed.pop()
# Iterate in reverse because conflict resolution tends to produce more
# general incompatibilities as time goes on. If we look at those first,
# we can derive stronger assignments sooner and more eagerly find
# conflicts.
for incompatibility in reversed(self._incompatibilities[package]):
result = self._propagate_incompatibility(incompatibility)
if result is _conflict:
# If the incompatibility is satisfied by the solution, we use
# _resolve_conflict() to determine the root cause of the conflict as a
# new incompatibility.
#
# It also backjumps to a point in the solution
# where that incompatibility will allow us to derive new assignments
# that avoid the conflict.
root_cause = self._resolve_conflict(incompatibility)
# Back jumping erases all the assignments we did at the previous
# decision level, so we clear [changed] and refill it with the
# newly-propagated assignment.
changed.clear()
changed.add(str(self._propagate_incompatibility(root_cause)))
break
elif result is not None:
changed.add(result)

@Greedquest Greedquest changed the title Bug In version solver when using a hashable object to represent a package, not just a string. Bug in version solver when using a hashable object to represent a package, not just a string. Apr 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant