From 97d2bb723b4b8d2f08fc2dbd2050e53b635eaba0 Mon Sep 17 00:00:00 2001 From: Goran Jelic-Cizmek Date: Fri, 10 Jan 2025 10:22:39 +0100 Subject: [PATCH] Replace `Py_True/False` w/`PyBool_FromLong` --- src/nrnpython/nrnpy_hoc.cpp | 2 +- src/nrnpython/nrnpy_nrn.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nrnpython/nrnpy_hoc.cpp b/src/nrnpython/nrnpy_hoc.cpp index ab3938bd83..af7cefcceb 100644 --- a/src/nrnpython/nrnpy_hoc.cpp +++ b/src/nrnpython/nrnpy_hoc.cpp @@ -206,7 +206,7 @@ static PyObject* nrnexec(PyObject* self, PyObject* args) { return NULL; } bool b = hoc_valid_stmt(cmd, 0); - return b ? Py_True : Py_False; + return PyBool_FromLong(b); } static PyObject* nrnexec_safe(PyObject* self, PyObject* args) { diff --git a/src/nrnpython/nrnpy_nrn.cpp b/src/nrnpython/nrnpy_nrn.cpp index ee32d9a552..031039e172 100644 --- a/src/nrnpython/nrnpy_nrn.cpp +++ b/src/nrnpython/nrnpy_nrn.cpp @@ -1590,7 +1590,7 @@ static PyObject* NPySecObj_has_membrane(NPySecObj* self, PyObject* args) { if (!PyArg_ParseTuple(args, "s", &mechanism_name)) { return NULL; } - result = has_membrane(mechanism_name, self->sec_) ? Py_True : Py_False; + result = PyBool_FromLong(has_membrane(mechanism_name, self->sec_)); Py_XINCREF(result); return result; }