From: Stefan Behnel Date: Tue, 6 Aug 2013 07:20:08 +0000 (+0200) Subject: minor C code simplification X-Git-Tag: 0.20b1~422 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=abe914c4d6912174a28d9b80bc7f6ca89dc346cf;p=platform%2Fupstream%2Fpython-cython.git minor C code simplification --- diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index 9e51e0b..46c39c7 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -1187,14 +1187,11 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): if cpp_class_attrs: self.generate_self_cast(scope, code) - if needs_gc and not base_type: - code.putln("PyObject_GC_UnTrack(o);") - if needs_finalisation: # before Py3.4, tp_finalize() isn't available, so this is # the earliest possible time where we can call it ourselves code.putln("#if PY_VERSION_HEX < 0x030400a1") - if needs_gc and base_type: + if needs_gc: # We must mark ths object as (gc) untracked while tearing # it down, lest the garbage collection is invoked while # running this destructor. @@ -1207,6 +1204,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): code.putln("PyObject_GC_Track(o);") code.putln("#endif") + if needs_gc and not base_type: + code.putln("PyObject_GC_UnTrack(o);") + for entry in cpp_class_attrs: split_cname = entry.type.cname.split('::') destructor_name = split_cname.pop()