summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Taylor <jtaylor.debian@googlemail.com>2013-09-12 17:42:55 +0200
committerJulian Taylor <jtaylor.debian@googlemail.com>2013-09-12 17:51:47 +0200
commit26ade56d9c4d44e8b0cc5d4268a65341743bccac (patch)
treef16cf75083a8ec30d4480de6cc52141bd16a3d58
parentf297de0aafe1f627a719304a0977fa3fc26879db (diff)
downloadnumpy-26ade56d9c4d44e8b0cc5d4268a65341743bccac.tar.gz
BUG: f2py, fix decref on wrong object
missing brackets causes decref on an wrong object. shows itself as abort with negative refcount in test_callback using python-dbg.
-rw-r--r--numpy/f2py/cfuncs.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/numpy/f2py/cfuncs.py b/numpy/f2py/cfuncs.py
index c8b529056..5a5d2bf64 100644
--- a/numpy/f2py/cfuncs.py
+++ b/numpy/f2py/cfuncs.py
@@ -1072,14 +1072,15 @@ goto capi_fail;
\t}
\t/* Get the number of optional arguments */
#if PY_VERSION_HEX >= 0x03000000
-\tif (PyObject_HasAttrString(tmp_fun,\"__defaults__\"))
+\tif (PyObject_HasAttrString(tmp_fun,\"__defaults__\")) {
\t\tif (PyTuple_Check(tmp = PyObject_GetAttrString(tmp_fun,\"__defaults__\")))
#else
-\tif (PyObject_HasAttrString(tmp_fun,\"func_defaults\"))
+\tif (PyObject_HasAttrString(tmp_fun,\"func_defaults\")) {
\t\tif (PyTuple_Check(tmp = PyObject_GetAttrString(tmp_fun,\"func_defaults\")))
#endif
\t\t\topt = PyTuple_Size(tmp);
\t\tPy_XDECREF(tmp);
+\t}
\t/* Get the number of extra arguments */
\tif (xa != NULL)
\t\text = PyTuple_Size((PyObject *)xa);