Part: Default geometry extensions make sure built-in types are initialised

This commit is contained in:
Abdullah Tahiri
2019-02-11 07:15:02 +01:00
committed by wmayer
parent dece5aa81d
commit 8b5e9b55c0
3 changed files with 36 additions and 7 deletions

View File

@@ -48,7 +48,7 @@ std::string GeometryIntExtensionPy::representation(void) const
PyObject *GeometryIntExtensionPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
{
// create a new instance of PointPy and the Twin object
// create a new instance of the python object and the Twin object
return new GeometryIntExtensionPy(new GeometryIntExtension);
}
@@ -68,11 +68,18 @@ int GeometryIntExtensionPy::PyInit(PyObject* args, PyObject* /*kwd*/)
return 0;
}
PyErr_Clear();
char * pystr;
if (PyArg_ParseTuple(args, "ls", &Id,&pystr)) {
this->getGeometryIntExtensionPtr()->setValue(Id);
this->getGeometryIntExtensionPtr()->setName(pystr);
return 0;
}
PyErr_SetString(PyExc_TypeError, "GeometryIntExtension constructor accepts:\n"
"-- empty parameter list\n"
"-- long int\n");
"-- long int\n"
"-- long int, string\n");
return -1;
}