1
0
forked from GitHub/gf-core

Generalise error handling

This commit is contained in:
John J. Camilleri
2021-09-09 11:16:10 +02:00
parent a44787fc4e
commit 5eade6f111
2 changed files with 39 additions and 44 deletions

View File

@@ -9,8 +9,10 @@
static PyObject *
Expr_str(ExprObject *self)
{
PgfText *s = pgf_print_expr((PgfExpr) &self, NULL, 1, &marshaller);
return PyString_FromStringAndSize(s->text, s->size);
PgfText *s = pgf_print_expr((PgfExpr) self, NULL, 1, &marshaller);
PyObject *str = PyString_FromStringAndSize(s->text, s->size);
free(s);
return str;
}
static PyObject *
@@ -204,8 +206,10 @@ PyTypeObject pgf_ExprLitType = {
static PyObject *
Type_str(TypeObject *self)
{
PgfText *s = pgf_print_type((PgfType) &self, NULL, 1, &marshaller);
return PyString_FromStringAndSize(s->text, s->size);
PgfText *s = pgf_print_type((PgfType) self, NULL, 1, &marshaller);
PyObject *str = PyString_FromStringAndSize(s->text, s->size);
free(s);
return str;
}
static PyObject *