def visit_DefNode(self, node):
pxd_def = self.scope.lookup(node.name)
- if pxd_def:
+ if pxd_def and (not pxd_def.scope or not pxd_def.scope.is_builtin_scope):
if not pxd_def.is_cfunction:
error(node.pos, "'%s' redeclared" % node.name)
if pxd_def.pos:
--- /dev/null
+# cython: auto_cpdef=True
+# mode:run
+# tag: directive,auto_cpdef
+
+import cython
+
+def str(arg):
+ """
+ This is a bit evil - str gets mapped to a C-API function and is
+ being redefined here.
+
+ >>> print(str('TEST'))
+ STR
+ """
+ return 'STR'
+
+@cython.test_assert_path_exists('//SimpleCallNode[@function.type.is_cfunction = True]')
+@cython.test_fail_if_path_exists('//SimpleCallNode[@function.type.is_builtin_type = True]')
+def call_str(arg):
+ """
+ >>> print(call_str('TEST'))
+ STR
+ """
+ return str(arg)