Skip to content

Commit f1d97c7

Browse files
allow callbacks to be nested
1 parent 53f89a8 commit f1d97c7

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/api/python/z3/z3.py

+14-7
Original file line numberDiff line numberDiff line change
@@ -11570,47 +11570,54 @@ def user_prop_fresh(ctx, _new_ctx):
1157011570

1157111571
def user_prop_fixed(ctx, cb, id, value):
1157211572
prop = _prop_closures.get(ctx)
11573-
prop.cb = cb
11573+
old_cb = prop.cb
11574+
prop.cb = cb
1157411575
id = _to_expr_ref(to_Ast(id), prop.ctx())
1157511576
value = _to_expr_ref(to_Ast(value), prop.ctx())
1157611577
prop.fixed(id, value)
11577-
prop.cb = None
11578+
prop.cb = old_cb
1157811579

1157911580
def user_prop_created(ctx, cb, id):
1158011581
prop = _prop_closures.get(ctx)
11582+
old_cb = prop.cb
1158111583
prop.cb = cb
1158211584
id = _to_expr_ref(to_Ast(id), prop.ctx())
1158311585
prop.created(id)
11584-
prop.cb = None
11586+
prop.cb = old_cb
11587+
1158511588

1158611589
def user_prop_final(ctx, cb):
1158711590
prop = _prop_closures.get(ctx)
11591+
old_cb = prop.cb
1158811592
prop.cb = cb
1158911593
prop.final()
11590-
prop.cb = None
11594+
prop.cb = old_cb
1159111595

1159211596
def user_prop_eq(ctx, cb, x, y):
1159311597
prop = _prop_closures.get(ctx)
11598+
old_cb = prop.cb
1159411599
prop.cb = cb
1159511600
x = _to_expr_ref(to_Ast(x), prop.ctx())
1159611601
y = _to_expr_ref(to_Ast(y), prop.ctx())
1159711602
prop.eq(x, y)
11598-
prop.cb = None
11603+
prop.cb = old_cb
1159911604

1160011605
def user_prop_diseq(ctx, cb, x, y):
1160111606
prop = _prop_closures.get(ctx)
11607+
old_cb = prop.cb
1160211608
prop.cb = cb
1160311609
x = _to_expr_ref(to_Ast(x), prop.ctx())
1160411610
y = _to_expr_ref(to_Ast(y), prop.ctx())
1160511611
prop.diseq(x, y)
11606-
prop.cb = None
11612+
prop.cb = old_cb
1160711613

1160811614
def user_prop_decide(ctx, cb, t, idx, phase):
1160911615
prop = _prop_closures.get(ctx)
11616+
old_cb = prop.cb
1161011617
prop.cb = cb
1161111618
t = _to_expr_ref(to_Ast(t_ref), prop.ctx())
1161211619
prop.decide(t, idx, phase)
11613-
prop.cb = None
11620+
prop.cb = old_cb
1161411621

1161511622

1161611623
_user_prop_push = Z3_push_eh(user_prop_push)

0 commit comments

Comments
 (0)