diff --git a/src/runtime/python/pypgf.c b/src/runtime/python/pypgf.c index 8c3afa189..bd7da4c86 100644 --- a/src/runtime/python/pypgf.c +++ b/src/runtime/python/pypgf.c @@ -1875,24 +1875,16 @@ PGF_getCategories(PGFObject *self, void *closure) return categories; } -static TypeObject* +static TypeObject * PGF_getStartCat(PGFObject *self, void *closure) { - TypeObject* pytype = (TypeObject*) pgf_TypeType.tp_alloc(&pgf_TypeType, 0); - if (pytype == NULL) - return NULL; - - // // pytype->pool = gu_new_pool(); - // pytype->type = pgf_start_cat(self->pgf, /*pytype->pool,*/ &unmarshaller); - // pytype->master = NULL; - // - // if (pytype->type == NULL) { + PgfType type = pgf_start_cat(self->pgf, &unmarshaller); + if (type == 0) { PyErr_SetString(PGFError, "The start category cannot be found"); - // Py_DECREF(pytype); return NULL; - // } - // - // return pytype; + } + + return (TypeObject *)type; } static void diff --git a/src/runtime/python/test_suite.py b/src/runtime/python/test_suite.py index 00c9b4d36..62f84a57b 100644 --- a/src/runtime/python/test_suite.py +++ b/src/runtime/python/test_suite.py @@ -120,5 +120,6 @@ def test_functionType_wrong(PGF): assert PGF.functionType("c") != pgf.readType("N -> S -> X") def test_startCat(PGF): - with pytest.raises(pgf.PGFError): - PGF.startCat() + # with pytest.raises(pgf.PGFError): + # PGF.startCat + assert PGF.startCat == pgf.readType("S")