From bf2db3acbbacca250f4a94f2a739d58b84bb4221 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 3 Mar 2011 22:52:20 -0500 Subject: [PATCH] Normalize WTK_declare_builtin_cfunction -> declare_builtin_cfunction. --- Cython/Compiler/Builtin.py | 10 +++++++--- Cython/Compiler/Symtab.py | 19 ++++--------------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/Cython/Compiler/Builtin.py b/Cython/Compiler/Builtin.py index d9c4207e..26ed45b5 100644 --- a/Cython/Compiler/Builtin.py +++ b/Cython/Compiler/Builtin.py @@ -2,6 +2,7 @@ # Pyrex - Builtin Definitions # +from Binding import Binding from Symtab import BuiltinScope, StructOrUnionScope from Code import UtilityCode from TypeSlots import Signature @@ -346,8 +347,10 @@ class BuiltinFunction(_BuiltinOverride): if sig is None: sig = Signature(self.args, self.ret_type) func_type = sig.function_type() - scope.declare_builtin_cfunction(self.py_name, func_type, self.cname, - self.py_equiv, self.utility_code) + binding = Binding(name = self.py_name, cname = self.cname, extern = 1) + scope.declare_builtin_cfunction( + binding, type = func_type, python_equiv = self.py_equiv, + utility_code = self.utility_code) class BuiltinMethod(_BuiltinOverride): def declare_in_type(self, self_type): @@ -359,8 +362,9 @@ class BuiltinMethod(_BuiltinOverride): self_arg = PyrexTypes.CFuncTypeArg("", self_type, None) self_arg.not_none = True method_type = sig.function_type(self_arg) + binding = Binding(name = self.py_name, cname = self.cname, extern = 1) self_type.scope.declare_builtin_cfunction( - self.py_name, method_type, self.cname, utility_code = self.utility_code) + binding, type = method_type, utility_code = self.utility_code) builtin_function_table = [ diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py index 1e2947c6..e849d1b1 100644 --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@ -853,14 +853,8 @@ class BuiltinScope(Scope): error(pos, "undeclared name not builtin: %s" % binding.name) - def declare_builtin_cfunction(self, name, type, cname, python_equiv = None, - utility_code = None): - binding = self._WTK_setup(name, cname, 'extern') - return self.WTK_declare_builtin_cfunction(binding, type, python_equiv, utility_code) - - def WTK_declare_builtin_cfunction( - self, binding, type, python_equiv = None, - utility_code = None): + def declare_builtin_cfunction(self, binding, type, python_equiv = None, + utility_code = None): # If python_equiv == "*", the Python equivalent has the same name # as the entry, otherwise it has the name specified by python_equiv. binding.name = EncodedString(binding.name) @@ -1860,13 +1854,8 @@ class CClassScope(ClassScope): entry.prev_entry = prev_entry return entry - def declare_builtin_cfunction(self, name, type, cname, utility_code = None): - binding = self._WTK_setup(name, cname, 'extern') - return self.WTK_declare_builtin_cfunction(binding, type, utility_code=utility_code) - - def WTK_declare_builtin_cfunction( - self, binding, type, python_equiv = None, - utility_code = None): + def declare_builtin_cfunction(self, binding, type, python_equiv = None, + utility_code = None): # overridden methods of builtin types still have their Python # equivalent that must be accessible to support bound methods binding.name = EncodedString(binding.name) -- 2.26.2