Skip to content

Commit

Permalink
Update index validation
Browse files Browse the repository at this point in the history
  • Loading branch information
jlalbers committed Sep 28, 2024
1 parent af58ab3 commit d2c94b2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dwave/optimization/model.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ cdef class Model:
Returns:
Feasibility of the state.
"""
cdef int num_states = self.state_size()
cdef Py_ssize_t num_states = self.states.size()

if not -num_states <= index < num_states:
raise ValueError(f"index out of range: {index}")
elif index < 0: # allow negative indexing
Expand Down

0 comments on commit d2c94b2

Please sign in to comment.