From c3b344084f79963b18beea93f7a13f1f584b307f Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Fri, 14 Jun 2013 07:02:53 +0000 Subject: [PATCH] bugfix in the python binding --- src/runtime/python/pypgf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/runtime/python/pypgf.c b/src/runtime/python/pypgf.c index 698b48ec9..8acfcf451 100644 --- a/src/runtime/python/pypgf.c +++ b/src/runtime/python/pypgf.c @@ -457,7 +457,7 @@ Iter_fetch_expr(IterObject* self) pyexpr->pool = NULL; pyexpr->expr = ep->expr; pyexpr->master = self->container; - Py_INCREF(self->container); + Py_XINCREF(self->container); PyObject* res = Py_BuildValue("(f,O)", ep->prob, pyexpr); Py_DECREF(pyexpr); @@ -1508,6 +1508,7 @@ PGF_generate(PGFObject* self, PyObject *args, PyObject *keywds) pyres->max_count = max_count; pyres->counter = 0; pyres->fetch = Iter_fetch_expr; + pyres->container = (PyObject*) pyres; GuPool *tmp_pool = gu_local_pool(); GuString catname = gu_str_string(catname_s, tmp_pool);