Commit 772e4665 authored by Jan Dinkelbach's avatar Jan Dinkelbach
Browse files

Merge branch 'fix-python-return-value' into 'master'

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

See merge request acs/public/simulation/dpsim!121

Former-commit-id: 218b96f7
parents d78bce04 5c83d4d9
......@@ -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 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))
Python::Node<VarType>* pyNode = (Python::Node<VarType>*) self;
pyNode->node->setInitialVoltage(CPS::Complex(initVoltage.real,initVoltage.imag), phaseIndex);
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