tp_new must always be generated to set the vtab
authorRobert Bradshaw <robertwb@math.washington.edu>
Thu, 17 Jan 2008 15:25:08 +0000 (07:25 -0800)
committerRobert Bradshaw <robertwb@math.washington.edu>
Thu, 17 Jan 2008 15:25:08 +0000 (07:25 -0800)
but we can get away with skipping intermediate classes if nothing new happens

Cython/Compiler/ModuleNode.py
Cython/Compiler/TypeSlots.py

index ccb4f7e6b40e3dbfa7845a32f88141ef1d9fcbd1..207b02154f5bcf3fe7e6186be33d5127f861e0fe 100644 (file)
@@ -610,8 +610,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
     def generate_new_function(self, scope, code):
         tp_slot = TypeSlots.ConstructorSlot("tp_new", '__new__')
         slot_func = scope.mangle_internal("tp_new")
-        if tp_slot.slot_code(scope) != slot_func:
-            return # never used
         type = scope.parent_type
         base_type = type.base_type
         py_attrs = []
index 8b647bd1850df4443613366bf3998cca6f91ed0b..f66dc1e7cc43b56a539a004cad0da1d7947f3e9b 100644 (file)
@@ -643,7 +643,7 @@ slot_table = (
     
     MethodSlot(initproc, "tp_init", "__init__"),
     EmptySlot("tp_alloc"), #FixedSlot("tp_alloc", "PyType_GenericAlloc"),
-    ConstructorSlot("tp_new", '__new__'),
+    InternalMethodSlot("tp_new"),
     EmptySlot("tp_free"),
     
     EmptySlot("tp_is_gc"),