Skip to content

Commit

Permalink
Implement __eq__ and __ne__ for python Bool (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
twizmwazin authored Nov 5, 2024
1 parent babcafb commit 4439661
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions crates/clarirs_py/src/ast/bool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,20 @@ impl Bool {
&GLOBAL_CONTEXT.xor(&self.inner, &<CoerceBool as Into<BoolAst>>::into(other))?,
)
}

pub fn __eq__(&self, py: Python, other: CoerceBool) -> Result<Py<Bool>, ClaripyError> {
Bool::new(
py,
&GLOBAL_CONTEXT.eq_(&self.inner, &<CoerceBool as Into<BoolAst>>::into(other))?,
)
}

pub fn __ne__(&self, py: Python, other: CoerceBool) -> Result<Py<Bool>, ClaripyError> {
Bool::new(
py,
&GLOBAL_CONTEXT.neq(&self.inner, &<CoerceBool as Into<BoolAst>>::into(other))?,
)
}
}

#[pyfunction(signature = (name, explicit_name = false))]
Expand Down

0 comments on commit 4439661

Please sign in to comment.