summaryrefslogtreecommitdiff
path: root/src/runtime/python
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2015-12-18 19:46:59 +0000
committerkrasimir <krasimir@chalmers.se>2015-12-18 19:46:59 +0000
commit6947d36e1a703ca33bb98eb64050262d6101a068 (patch)
tree0bb9d1695fe14b8949ac1bf5f2d7ae5f49254aaf /src/runtime/python
parentfe1ce8389c73c43b9374959d6e894e2370ffa957 (diff)
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
Diffstat (limited to 'src/runtime/python')
-rw-r--r--src/runtime/python/pypgf.c3
1 files changed, 3 insertions, 0 deletions
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,