ASP-based solver: don't sort when defining variant possible values (#29013)
fixes #28260 Since we iterate over different variants from many packages, the variant values may have types which are not comparable, which causes errors at runtime. This is not a real issue though, since we don't need the facts to be ordered. Thus, to avoid needless sorting, the sorted function has been removed and a comment has been added to tip any developer that might need to inspect these clauses for debugging to add back sorting on the first two items only. It's kind of difficult to add a test for this, since the error depends on whether Python sorting algorithm ever needs to compare the third value of a tuple being ordered.
This commit is contained in:
parent
a0bd6c8817
commit
fa132614e0
1 changed files with 3 additions and 2 deletions
|
@ -1617,8 +1617,9 @@ def define_variant_values(self):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# Tell the concretizer about possible values from specs we saw in
|
# Tell the concretizer about possible values from specs we saw in
|
||||||
# spec_clauses()
|
# spec_clauses(). We might want to order these facts by pkg and name
|
||||||
for pkg, variant, value in sorted(self.variant_values_from_specs):
|
# if we are debugging.
|
||||||
|
for pkg, variant, value in self.variant_values_from_specs:
|
||||||
self.gen.fact(fn.variant_possible_value(pkg, variant, value))
|
self.gen.fact(fn.variant_possible_value(pkg, variant, value))
|
||||||
|
|
||||||
def _facts_from_concrete_spec(self, spec, possible):
|
def _facts_from_concrete_spec(self, spec, possible):
|
||||||
|
|
Loading…
Reference in a new issue