summaryrefslogtreecommitdiff
path: root/numpy/f2py
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 18:11:18 +0200
commit84b69f8dc822e977b5fae48b32c43f572800c8a2 (patch)
treee76ba3a9113bd8446465ba7f5f50ef54d6f5d25c /numpy/f2py
parent32e375f3b00508675618f9c16db6d1ebeea82e6d (diff)
downloadnumpy-84b69f8dc822e977b5fae48b32c43f572800c8a2.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.
Diffstat (limited to 'numpy/f2py')
-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);