3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-04-15 08:44:10 +00:00

Fix two bugs in Python examples

- bincover.py: typo `NOne` -> `None` in _value2bin fallback path
  (would raise NameError if bin_index is out of range).

- complex/complex.py: rename `__neq__` to `__ne__`. Python has no
  `__neq__` dunder, so `!=` was not using the intended definition.
  On Python 3 it silently fell back to the auto-derived inverse of
  `__eq__`; on Python 2 it fell back to identity comparison.
This commit is contained in:
Gary Hu 2026-04-14 11:09:19 +08:00
parent 1d19d4a0dc
commit c2d36054d1
2 changed files with 2 additions and 2 deletions

View file

@ -195,7 +195,7 @@ class BinCoverSolver(UserPropagateBase):
assert isinstance(value, BitVecNumRef)
bin_index = value.as_long()
if bin_index >= len(self.bins):
return NOne
return None
return self.bins[bin_index]
def _add_item2bin(self, item, bin):

View file

@ -81,7 +81,7 @@ class ComplexExpr:
other = _to_complex(other)
return And(self.r == other.r, self.i == other.i)
def __neq__(self, other):
def __ne__(self, other):
return Not(self.__eq__(other))
def simplify(self):