3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-07 18:05:21 +00:00

expose _get_ctx for scope semantics of newer versions of python #2441

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2019-07-29 07:54:47 +08:00
parent 2bd8d3b485
commit 902c683b92
2 changed files with 9 additions and 6 deletions

View file

@ -236,6 +236,9 @@ def _get_ctx(ctx):
else:
return ctx
def get_ctx(ctx):
return _get_ctx(ctx)
def set_param(*args, **kws):
"""Set Z3 global (or module) parameters.

View file

@ -21,21 +21,21 @@ def _to_rcfnum(num, ctx=None):
return RCFNum(num, ctx)
def Pi(ctx=None):
ctx = z3._get_ctx(ctx)
ctx = z3.get_ctx(ctx)
return RCFNum(Z3_rcf_mk_pi(ctx.ref()), ctx)
def E(ctx=None):
ctx = z3._get_ctx(ctx)
ctx = z3.get_ctx(ctx)
return RCFNum(Z3_rcf_mk_e(ctx.ref()), ctx)
def MkInfinitesimal(name="eps", ctx=None):
# Todo: remove parameter name.
# For now, we keep it for backward compatibility.
ctx = z3._get_ctx(ctx)
ctx = z3.get_ctx(ctx)
return RCFNum(Z3_rcf_mk_infinitesimal(ctx.ref()), ctx)
def MkRoots(p, ctx=None):
ctx = z3._get_ctx(ctx)
ctx = z3.get_ctx(ctx)
num = len(p)
_tmp = []
_as = (RCFNumObj * num)()
@ -55,9 +55,9 @@ class RCFNum:
# TODO: add support for converting AST numeral values into RCFNum
if isinstance(num, RCFNumObj):
self.num = num
self.ctx = z3._get_ctx(ctx)
self.ctx = z3.get_ctx(ctx)
else:
self.ctx = z3._get_ctx(ctx)
self.ctx = z3.get_ctx(ctx)
self.num = Z3_rcf_mk_rational(self.ctx_ref(), str(num))
def __del__(self):