Commit e184629e authored by Steffen Vogel's avatar Steffen Vogel 🎅🏼
Browse files

python: fix invalid return value for Node::setInitialVoltage()

parent c9cc1e56
......@@ -53,7 +53,7 @@ namespace Python {
static PyObject* voltage(PyObject *self, PyObject *args);
static PyObject* gnd(PyObject *self, PyObject *args);
static void setInitialVoltage(PyObject *self, PyObject *args, PyObject *kwds);
static PyObject* setInitialVoltage(PyObject *self, PyObject *args, PyObject *kwds);
static const char *name;
static const char *doc;
......
......@@ -163,7 +163,7 @@ const char* Python::Node<VarType>::docSetInitialVoltage =
"set_initial_voltage\n"
"Set the initial voltage at this node.\n";
template<typename VarType>
void Python::Node<VarType>::setInitialVoltage(PyObject *self, PyObject *args, PyObject *kwds) {
PyObject* Python::Node<VarType>::setInitialVoltage(PyObject *self, PyObject *args, PyObject *kwds) {
Py_complex initVoltage;
CPS::Int phaseIndex;
......@@ -171,10 +171,12 @@ void Python::Node<VarType>::setInitialVoltage(PyObject *self, PyObject *args, Py
static const char *kwlist[] = {"voltage", "index", nullptr};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "Di", (char **) kwlist, &initVoltage, &phaseIndex))
return;
Py_RETURN_NONE;
Python::Node<VarType>* pyNode = (Python::Node<VarType>*) self;
pyNode->node->setInitialVoltage(CPS::Complex(initVoltage.real,initVoltage.imag), phaseIndex);
Py_RETURN_NONE;
}
template<typename VarType>
......
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