From 350c777f156fb45b0526db97f9575f6c69bbcab1 Mon Sep 17 00:00:00 2001 From: Kevin Phoenix Date: Tue, 1 Oct 2024 18:45:00 -0700 Subject: [PATCH] Change Bool is_true and is_false implementations to avoid backends --- claripy/ast/bool.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/claripy/ast/bool.py b/claripy/ast/bool.py index 6d2aafbfc..e492c9f57 100644 --- a/claripy/ast/bool.py +++ b/claripy/ast/bool.py @@ -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 @@ -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