From: Robert Bradshaw Date: Thu, 17 Jan 2008 15:25:08 +0000 (-0800) Subject: tp_new must always be generated to set the vtab X-Git-Tag: 0.9.6.14~29^2~65 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=73011bd8200c36400119dc18f5881fea90559dba;p=cython.git tp_new must always be generated to set the vtab but we can get away with skipping intermediate classes if nothing new happens --- diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index ccb4f7e6..207b0215 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -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 = [] diff --git a/Cython/Compiler/TypeSlots.py b/Cython/Compiler/TypeSlots.py index 8b647bd1..f66dc1e7 100644 --- a/Cython/Compiler/TypeSlots.py +++ b/Cython/Compiler/TypeSlots.py @@ -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"),