From 14769484a5af47665fbbe42d3b2da70fa0bde088 Mon Sep 17 00:00:00 2001 From: krasimir Date: Fri, 18 Dec 2015 19:46:59 +0000 Subject: [PATCH] fix in the Python binding. The input sentence to the parser needs to be copied since otherwise the Python string may be discarded the garbage collector --- src/runtime/python/pypgf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/runtime/python/pypgf.c b/src/runtime/python/pypgf.c index 1ea4974e4..9f88a771b 100644 --- a/src/runtime/python/pypgf.c +++ b/src/runtime/python/pypgf.c @@ -1429,6 +1429,9 @@ Concr_parse(ConcrObject* self, PyObject *args, PyObject *keywds) pypgf_new_callbacks_map(self->concr, py_callbacks, pyres->pool); if (callbacks == NULL) return NULL; + + sentence = gu_string_copy(sentence, pyres->pool); + pyres->res = pgf_parse_with_heuristics(self->concr, catname, sentence, heuristics, callbacks, parse_err,