disable unnecessary PyType_IS_GC() check in PyPy (not supported)
authorStefan Behnel <stefan_ml@behnel.de>
Wed, 16 Oct 2013 04:54:27 +0000 (06:54 +0200)
committerStefan Behnel <stefan_ml@behnel.de>
Wed, 16 Oct 2013 04:54:27 +0000 (06:54 +0200)
Cython/Compiler/ModuleNode.py

index a50702a..88e6ae0 100644 (file)
@@ -1252,8 +1252,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
                 if base_type.scope and base_type.scope.needs_gc():
                     code.putln("PyObject_GC_Track(o);")
                 else:
-                    code.putln("if (PyType_IS_GC(Py_TYPE(o)->tp_base))"
-                               " PyObject_GC_Track(o);")
+                    code.putln("#if CYTHON_COMPILING_IN_CPYTHON")
+                    code.putln("if (PyType_IS_GC(Py_TYPE(o)->tp_base))")
+                    code.putln("#endif")
+                    code.putln("PyObject_GC_Track(o);")
 
             tp_dealloc = TypeSlots.get_base_slot_function(scope, tp_slot)
             if tp_dealloc is not None: