summaryrefslogtreecommitdiff
path: root/Cython/Compiler/ModuleNode.py
diff options
context:
space:
mode:
authorTorsten Landschoff <torsten.landschoff@dynamore.de>2013-08-01 23:37:30 +0200
committerTorsten Landschoff <torsten.landschoff@dynamore.de>2013-08-01 23:37:30 +0200
commitefbff33790a9fbfe6aa83491c18091018744d750 (patch)
tree5af370d82c2c052fa24e3925814d6b68ecc5e5d7 /Cython/Compiler/ModuleNode.py
parent1af954aec08883fea91855db7d1a0a78f9bb41cf (diff)
downloadcython-efbff33790a9fbfe6aa83491c18091018744d750.tar.gz
Change tp_clear generation to clear to NULL.
Better to crash early than to never know that the reference changed to None. See discussion here: http://article.gmane.org/gmane.comp.python.cython.devel/14833
Diffstat (limited to 'Cython/Compiler/ModuleNode.py')
-rw-r--r--Cython/Compiler/ModuleNode.py9
1 files changed, 1 insertions, 8 deletions
diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py
index 6f2a11488..8ba86782f 100644
--- a/Cython/Compiler/ModuleNode.py
+++ b/Cython/Compiler/ModuleNode.py
@@ -1367,7 +1367,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
if py_attrs or py_buffers:
self.generate_self_cast(scope, code)
- code.putln("PyObject* tmp;")
if base_type:
# want to call it explicitly if possible so inlining can be performed
@@ -1390,13 +1389,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
UtilityCode.load_cached("CallNextTpClear", "ExtensionTypes.c"))
for entry in py_attrs:
- name = "p->%s" % entry.cname
- code.putln("tmp = ((PyObject*)%s);" % name)
- if entry.is_declared_generic:
- code.put_init_to_py_none(name, py_object_type, nanny=False)
- else:
- code.put_init_to_py_none(name, entry.type, nanny=False)
- code.putln("Py_XDECREF(tmp);")
+ code.putln("Py_CLEAR(p->%s);" % entry.cname)
for entry in py_buffers:
# Note: shouldn't this call __Pyx_ReleaseBuffer ??