From 07c3f4b88a5a8c007ff6b1d4e1aaf26486e5e46b Mon Sep 17 00:00:00 2001 From: krangelov Date: Mon, 27 Sep 2021 07:27:44 +0200 Subject: [PATCH] fix Expr_visit --- src/runtime/python/expr.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/runtime/python/expr.c b/src/runtime/python/expr.c index efa1a64f9..9f88db9d4 100644 --- a/src/runtime/python/expr.c +++ b/src/runtime/python/expr.c @@ -280,6 +280,9 @@ Expr_visit(ExprObject* self, PyObject *args) if (PyObject_TypeCheck(arg, &pgf_ExprImplArgType)) { arg = ((ExprImplArgObject *) arg)->expr; } + if (PyObject_TypeCheck(arg, &pgf_ExprTypedType)) { + arg = ((ExprTypedObject *) arg)->expr; + } Py_INCREF(arg); if (PyTuple_SetItem(method_args, i, (PyObject *) arg) == -1) { @@ -300,7 +303,11 @@ Expr_visit(ExprObject* self, PyObject *args) return NULL; } - return PyObject_CallObject(method, method_args); + PyObject *res = PyObject_CallObject(method, method_args); + + Py_DECREF(method_args); + + return res; } }