From 73011bd8200c36400119dc18f5881fea90559dba Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Thu, 17 Jan 2008 07:25:08 -0800 Subject: [PATCH] tp_new must always be generated to set the vtab but we can get away with skipping intermediate classes if nothing new happens --- Cython/Compiler/ModuleNode.py | 2 -- Cython/Compiler/TypeSlots.py | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) 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"), -- 2.26.2