Skip to content

Commit

Permalink
Fix life
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Cornu committed Dec 13, 2024
1 parent 5b032d5 commit 3840620
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/nrnpython/nrnpy_nrn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,18 @@ static Object* pysec_cell(Section* sec) {
} else if (err == 0) {
return nullptr;
}
auto ret = nrnpy_po2ho(cell);
Py_DECREF(cell);
return ret;
#else
PyObject* cell = PyWeakref_GetObject(cell_weakref);
if (!cell) {
PyErr_Print();
hoc_execerror("Error getting cell for", secname(sec));
} else if (cell == Py_None) {
return nullptr;
} else if (cell != Py_None) {
return nrnpy_po2ho(cell);
}
#endif
return nrnpy_po2ho(cell);
}
}
return NULL;
Expand Down Expand Up @@ -234,14 +236,17 @@ static int pysec_cell_equals(Section* sec, Object* obj) {
PyErr_Print();
hoc_execerror("Error getting cell for", secname(sec));
}
auto ret = nrnpy_ho_eq_po(obj, cell);
Py_DECREF(cell);
return ret;
#else
PyObject* cell = PyWeakref_GetObject(cell_weakref);
if (!cell) {
PyErr_Print();
hoc_execerror("Error getting cell for", secname(sec));
}
#endif
return nrnpy_ho_eq_po(obj, cell);
#endif
}
return nrnpy_ho_eq_po(obj, Py_None);
}
Expand Down

0 comments on commit 3840620

Please sign in to comment.