Handle expections in PointsPy class
This commit is contained in:
parent
54d4e2cab9
commit
93e0c6688d
|
@ -59,14 +59,20 @@ int PointsPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||||
*getPointKernelPtr() = *(static_cast<PointsPy*>(pcObj)->getPointKernelPtr());
|
*getPointKernelPtr() = *(static_cast<PointsPy*>(pcObj)->getPointKernelPtr());
|
||||||
}
|
}
|
||||||
else if (PyList_Check(pcObj)) {
|
else if (PyList_Check(pcObj)) {
|
||||||
addPoints(args);
|
if (!addPoints(args))
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
else if (PyTuple_Check(pcObj)) {
|
else if (PyTuple_Check(pcObj)) {
|
||||||
addPoints(args);
|
if (!addPoints(args))
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
else if (PyString_Check(pcObj)) {
|
else if (PyString_Check(pcObj)) {
|
||||||
getPointKernelPtr()->load(PyString_AsString(pcObj));
|
getPointKernelPtr()->load(PyString_AsString(pcObj));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
PyErr_SetString(PyExc_TypeError, "optional argument must be list, tuple or string");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user