self_arg = PyrexTypes.CFuncTypeArg("", self_type, None)
self_arg.not_none = True
method_type = sig.function_type(self_arg)
- self_type.scope.declare_cfunction(self.py_name, method_type, None, self.cname,
- utility_code = self.utility_code)
+ self_type.scope.declare_builtin_cfunction(
+ self.py_name, method_type, self.cname, utility_code = self.utility_code)
builtin_function_table = [
entry.is_cmethod = 1
entry.prev_entry = prev_entry
return entry
-
+
+ def declare_builtin_cfunction(self, name, type, cname, utility_code = None):
+ # overridden methods of builtin types still have their Python
+ # equivalent that must be accessible to support bound methods
+ name = EncodedString(name)
+ entry = self.declare_cfunction(name, type, None, cname, visibility='extern',
+ utility_code = utility_code)
+ var_entry = Entry(name, name, py_object_type)
+ var_entry.is_variable = 1
+ var_entry.is_builtin = 1
+ var_entry.utility_code = utility_code
+ entry.as_variable = var_entry
+ return entry
+
def declare_property(self, name, doc, pos):
entry = self.lookup_here(name)
if entry is None: