Skip to content

Commit

Permalink
Change Bool is_true and is_false implementations to avoid backends
Browse files Browse the repository at this point in the history
  • Loading branch information
twizmwazin committed Oct 2, 2024
1 parent 14cea3a commit 350c777
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions claripy/ast/bool.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
from __future__ import annotations

import logging
from contextlib import suppress
from functools import lru_cache
from typing import TYPE_CHECKING, overload

import claripy
from claripy import operations
from claripy.ast.base import ASTCacheKey, Base, _make_name
from claripy.errors import BackendError, ClaripyTypeError
from claripy.errors import ClaripyTypeError

from .bits import Bits

Expand Down Expand Up @@ -163,17 +162,17 @@ def If(cond, true_value, false_value):
Bool.__ror__ = Or


def is_true(e, exact=None): # pylint:disable=unused-argument
with suppress(BackendError):
return claripy.backends.concrete.is_true(e)
def is_true(e):
if claripy.simplify(e) is True:
return True

log.debug("Unable to tell the truth-value of this expression")
return False


def is_false(e, exact=None): # pylint:disable=unused-argument
with suppress(BackendError):
return claripy.backends.concrete.is_false(e)
def is_false(e):
if claripy.simplify(e) is False:
return True

log.debug("Unable to tell the truth-value of this expression")
return False
Expand Down

0 comments on commit 350c777

Please sign in to comment.