summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2013-09-12 08:56:27 -0700
committerCharles Harris <charlesr.harris@gmail.com>2013-09-12 08:56:27 -0700
commitf1f084245b0bf676f5c81ba16a89e1cb97f0d90f (patch)
treef16cf75083a8ec30d4480de6cc52141bd16a3d58
parentf297de0aafe1f627a719304a0977fa3fc26879db (diff)
parent26ade56d9c4d44e8b0cc5d4268a65341743bccac (diff)
downloadnumpy-f1f084245b0bf676f5c81ba16a89e1cb97f0d90f.tar.gz
Merge pull request #3728 from juliantaylor/f2py-negative-refcount
BUG: f2py, fix decref on wrong object
-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);