Commit d1106919 authored by Georg Martin Reinke's avatar Georg Martin Reinke
Browse files

simplify load_cim

parent 1daa562d
......@@ -108,19 +108,8 @@ PyObject* DPsim::pyLoadCim(PyObject* self, PyObject* args) {
std::vector<BaseComponent*> comps = reader->getComponents();
list = PyList_New(comps.size());
for (int i = 0; i < comps.size(); i++) {
// corresponds to "pyComp = dpsim.Component()" in Python
PyObject *emptyTuple = PyTuple_New(0);
PyComponent* pyComp = (PyComponent*) PyObject_CallObject((PyObject*) &PyComponentType, emptyTuple);
Py_DECREF(emptyTuple);
if (!pyComp) {
Py_DECREF(list);
delete reader;
return nullptr;
}
/*
PyComponent* pyComp = PyObject_New(PyComponent, &PyComponentType);
PyObject_Init((PyObject*) pyComp, &PyComponentType);
*/
pyComp->comp = comps[i];
PyList_SET_ITEM(list, i, (PyObject*) pyComp);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment