1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
From: Victor Stinner <vstinner@python.org>
Date: Fri, 23 May 2025 01:50:15 +0200
Subject: Fix dsdp.sdp() reference counting
Origin: upstream, https://github.com/cvxopt/cvxopt/pull/261
Bug-Debian: https://bugs.debian.org/1117894
Last-Update: 2025-10-12
---
src/C/dsdp.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/C/dsdp.c b/src/C/dsdp.c
index 792ceee..2640170 100644
--- a/src/C/dsdp.c
+++ b/src/C/dsdp.c
@@ -176,14 +176,17 @@ static PyObject* solvesdp(PyObject *self, PyObject *args,
goto done;
}
- if (opts && PyDict_Check(opts))
+ if (opts && PyDict_Check(opts)) {
+ Py_INCREF(opts);
param = opts;
+ }
else
param = PyObject_GetAttrString(dsdp_module, "options");
if (!param || !PyDict_Check(param)){
PyErr_SetString(PyExc_AttributeError, "missing dsdp.options "
" dictionary");
t = NULL;
+ Py_XDECREF(param);
goto done;
}
while (PyDict_Next(param, &pos, &key, &value))
|