Skip to content

Commit

Permalink
BUG: f2py, fix decref on wrong object
Browse files Browse the repository at this point in the history
missing brackets causes decref on an wrong object.
shows itself as abort with negative refcount in test_callback using
python-dbg.
  • Loading branch information
juliantaylor committed Sep 12, 2013
1 parent a0d6f9a commit 1e2f9ba
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions numpy/f2py/cfuncs.py
Expand Up @@ -1072,14 +1072,15 @@
\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);
Expand Down

0 comments on commit 1e2f9ba

Please sign in to comment.