From: Stefan Behnel Date: Sat, 10 Aug 2013 10:12:45 +0000 (+0200) Subject: avoid generating empty PyMethodDef array for types (especially closures) X-Git-Tag: 0.20b1~396 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=23ef44c7b26041b32d7274fb485f84a03df654ce;p=platform%2Fupstream%2Fpython-cython.git avoid generating empty PyMethodDef array for types (especially closures) --- diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index a482042..db7266e 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -1820,6 +1820,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): "};") def generate_method_table(self, env, code): + if env.is_c_class_scope and not env.pyfunc_entries: + return code.putln("") code.putln( "static PyMethodDef %s[] = {" % diff --git a/Cython/Compiler/TypeSlots.py b/Cython/Compiler/TypeSlots.py index 118c704..089d039 100644 --- a/Cython/Compiler/TypeSlots.py +++ b/Cython/Compiler/TypeSlots.py @@ -460,7 +460,10 @@ class MethodTableSlot(SlotDescriptor): # Slot descriptor for the method table. def slot_code(self, scope): - return scope.method_table_cname + if scope.pyfunc_entries: + return scope.method_table_cname + else: + return "0" class MemberTableSlot(SlotDescriptor):