Skip to content

Commit

Permalink
extra checks when arg is range
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnaceBleukx authored Jun 5, 2024
1 parent 6eed364 commit ba6585f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions xcsp3/executable/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,15 +752,19 @@ def get_cpm_vars(self, lst):
if isinstance(lst[0], (XVar, int)):
return [self.get_cpm_var(x) for x in lst]
if isinstance(lst[0], range):
return list(eval(str(lst[0])))
assert len(lst) == 1, "Expected range here, but got list with multiple elements, what's the semantics???
return list(lst[0]) # this should work without converting to str first
# return list(eval(str(lst[0])))
else:
return self.vars_from_node(lst)

def get_cpm_exprs(self, lst):
if isinstance(lst[0], XVar):
return [self.get_cpm_var(x) for x in lst]
if isinstance(lst[0], range):
return list(eval(str(lst[0])))
assert len(lst) == 1, "Expected range here, but got list with multiple elements, what's the semantics???
return list(lst[0]) # this should work without converting to str first
# return list(eval(str(lst[0])))
else:
return self.exprs_from_node(lst)

Expand Down

0 comments on commit ba6585f

Please sign in to comment.