forked from GitHub/gf-core
Implement PGF_getStartCat in Python bindings
This commit is contained in:
@@ -1875,24 +1875,16 @@ PGF_getCategories(PGFObject *self, void *closure)
|
|||||||
return categories;
|
return categories;
|
||||||
}
|
}
|
||||||
|
|
||||||
static TypeObject*
|
static TypeObject *
|
||||||
PGF_getStartCat(PGFObject *self, void *closure)
|
PGF_getStartCat(PGFObject *self, void *closure)
|
||||||
{
|
{
|
||||||
TypeObject* pytype = (TypeObject*) pgf_TypeType.tp_alloc(&pgf_TypeType, 0);
|
PgfType type = pgf_start_cat(self->pgf, &unmarshaller);
|
||||||
if (pytype == NULL)
|
if (type == 0) {
|
||||||
return NULL;
|
|
||||||
|
|
||||||
// // pytype->pool = gu_new_pool();
|
|
||||||
// pytype->type = pgf_start_cat(self->pgf, /*pytype->pool,*/ &unmarshaller);
|
|
||||||
// pytype->master = NULL;
|
|
||||||
//
|
|
||||||
// if (pytype->type == NULL) {
|
|
||||||
PyErr_SetString(PGFError, "The start category cannot be found");
|
PyErr_SetString(PGFError, "The start category cannot be found");
|
||||||
// Py_DECREF(pytype);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// return pytype;
|
return (TypeObject *)type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -120,5 +120,6 @@ def test_functionType_wrong(PGF):
|
|||||||
assert PGF.functionType("c") != pgf.readType("N -> S -> X")
|
assert PGF.functionType("c") != pgf.readType("N -> S -> X")
|
||||||
|
|
||||||
def test_startCat(PGF):
|
def test_startCat(PGF):
|
||||||
with pytest.raises(pgf.PGFError):
|
# with pytest.raises(pgf.PGFError):
|
||||||
PGF.startCat()
|
# PGF.startCat
|
||||||
|
assert PGF.startCat == pgf.readType("S")
|
||||||
|
|||||||
Reference in New Issue
Block a user