summaryrefslogtreecommitdiff
path: root/src/runtime/python
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2016-06-16 08:02:06 +0000
committerkrasimir <krasimir@chalmers.se>2016-06-16 08:02:06 +0000
commit821878773c58a81fa92cdcbfd3be9a2f5a0cf12d (patch)
treec38c116cf3f7b8c2d858cedec483620511bbfd78 /src/runtime/python
parent630b9d7b1eccc415cc7613d2473ffaa0ee9b39fa (diff)
bugfix in the load method in the Python binding. The file was never closed.
Diffstat (limited to 'src/runtime/python')
-rw-r--r--src/runtime/python/pypgf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/runtime/python/pypgf.c b/src/runtime/python/pypgf.c
index c3eef6afc..f2d55bf74 100644
--- a/src/runtime/python/pypgf.c
+++ b/src/runtime/python/pypgf.c
@@ -2257,13 +2257,13 @@ Concr_load(ConcrObject* self, PyObject *args)
// Read the PGF grammar.
pgf_concrete_load(self->concr, in, err);
if (!gu_ok(err)) {
+ fclose(infile);
if (gu_exn_caught(err, GuErrno)) {
errno = *((GuErrno*) gu_exn_caught_data(err));
PyErr_SetFromErrnoWithFilename(PyExc_IOError, fpath);
} else if (gu_exn_caught(err, PgfExn)) {
GuString msg = (GuString) gu_exn_caught_data(err);
PyErr_SetString(PGFError, msg);
- return NULL;
} else {
PyErr_SetString(PGFError, "The language cannot be loaded");
}
@@ -2272,6 +2272,8 @@ Concr_load(ConcrObject* self, PyObject *args)
gu_pool_free(tmp_pool);
+ fclose(infile);
+
Py_RETURN_NONE;
}