summaryrefslogtreecommitdiff
path: root/numpy/f2py/common_rules.py
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2018-12-31 01:28:17 +0100
committerSebastian Berg <sebastian@sipsolutions.net>2019-08-19 13:13:28 -0500
commit684bee2ae868c1bd8cb4fd4066d447ca35bd848e (patch)
tree14bd42e7116fa472800d2524c317f5ba20d2dca2 /numpy/f2py/common_rules.py
parent98bdde643af6443d68a8c6233807b75bd3f0ed80 (diff)
downloadnumpy-684bee2ae868c1bd8cb4fd4066d447ca35bd848e.tar.gz
BUG: General fixes to f2py reference counts (dereferencing)
Diffstat (limited to 'numpy/f2py/common_rules.py')
-rw-r--r--numpy/f2py/common_rules.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/numpy/f2py/common_rules.py b/numpy/f2py/common_rules.py
index 62c1ba207..f61d8810a 100644
--- a/numpy/f2py/common_rules.py
+++ b/numpy/f2py/common_rules.py
@@ -124,8 +124,9 @@ def buildhooks(m):
cadd('\t%s(f2pyinit%s,F2PYINIT%s)(f2py_setup_%s);'
% (F_FUNC, lower_name, name.upper(), name))
cadd('}\n')
- iadd('\tF2PyDict_SetItemString(d, \"%s\", PyFortranObject_New(f2py_%s_def,f2py_init_%s));' % (
- name, name, name))
+ iadd('\ttmp = PyFortranObject_New(f2py_%s_def,f2py_init_%s);' % (name, name))
+ iadd('\tF2PyDict_SetItemString(d, \"%s\", tmp);' % name)
+ iadd('\tPy_DECREF(tmp);')
tname = name.replace('_', '\\_')
dadd('\\subsection{Common block \\texttt{%s}}\n' % (tname))
dadd('\\begin{description}')