mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-20 10:19:32 -06:00
Type initialiser accepts sequences, stores internally as tuples. Add tests which try to break things.
This commit is contained in:
@@ -184,13 +184,17 @@ Transaction_createCategory(TransactionObject *self, PyObject *args)
|
||||
Py_ssize_t size;
|
||||
PyObject *hypos;
|
||||
prob_t prob = 0.0;
|
||||
if (!PyArg_ParseTuple(args, "s#O!f", &s, &size, &PyList_Type, &hypos, &prob))
|
||||
if (!PyArg_ParseTuple(args, "s#Of", &s, &size, &hypos, &prob))
|
||||
return NULL;
|
||||
if (!PySequence_Check(hypos)) {
|
||||
PyErr_SetString(PyExc_TypeError, "context must be a sequence");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PgfText *catname = CString_AsPgfText(s, size);
|
||||
|
||||
Py_ssize_t n_hypos;
|
||||
PgfTypeHypo *context = PyList_AsHypos(hypos, &n_hypos);
|
||||
PgfTypeHypo *context = PySequence_AsHypos(hypos, &n_hypos);
|
||||
if (PyErr_Occurred()) {
|
||||
FreePgfText(catname);
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user