disable builtin functions that conflict with type names
authorRobert Bradshaw <robertwb@math.washington.edu>
Sat, 24 Feb 2007 12:44:11 +0000 (04:44 -0800)
committerRobert Bradshaw <robertwb@math.washington.edu>
Sat, 24 Feb 2007 12:44:11 +0000 (04:44 -0800)
add dummy py_index for cdef arrays so subexprs valid

Cython/Compiler/ExprNodes.py
Cython/Compiler/Symtab.py

index 34fce8621e1851a5197479df864a398fde678d2d..6c47844dab6a7c8183ba151833de6d617516ba2f 100644 (file)
@@ -1056,6 +1056,7 @@ class IndexNode(ExprNode):
             self.type = py_object_type
             self.is_temp = 1
         else:
+            self.py_index = CloneNode(self.index) # so that it exists for subexpr processing
             if self.base.type.is_ptr or self.base.type.is_array:
                 self.type = self.base.type.base_type
             else:
index 5368dffc46693344fbcd79f8a2d1d002f6ac0309..0efd91da66c8cd213156ea583257faecebde78dc 100644 (file)
@@ -457,18 +457,31 @@ class BuiltinScope(Scope):
         entry.is_builtin = 1
         return entry
         
+    # TODO: built in functions conflict with built in types of same name...
+    
     builtin_functions = {
       "hasattr": ["PyObject_HasAttrString", c_int_type, (py_object_type, c_char_ptr_type)],
       "cmp":     ["PyObject_Compare", c_int_type, (py_object_type, py_object_type), None, True],
       "repr":    ["PyObject_Repr", py_object_type, (py_object_type, ), 0],
-      "str":     ["PyObject_Str", py_object_type, (py_object_type, ), 0],
+#      "str":     ["PyObject_Str", py_object_type, (py_object_type, ), 0],
       "unicode": ["PyObject_Unicode", py_object_type, (py_object_type, ), 0],
       "isinstance": ["PyObject_IsInstance", c_int_type, (py_object_type, py_object_type), -1],
       "hash":    ["PyObject_Hash", c_long_type, (py_object_type, ), -1, True],
       "type":    ["PyObject_Type", py_object_type, (py_object_type, ), 0],
       "len":     ["PyObject_Size", c_py_ssize_t_type, (py_object_type, ), -1],
       "dir":     ["PyObject_Dir", py_object_type, (py_object_type, ), 0],
-      "iter":     ["PyObject_GetIter", py_object_type, (py_object_type, ), 0],
+      "iter":    ["PyObject_GetIter", py_object_type, (py_object_type, ), 0],
+
+      "abs":     ["PyNumber_Absolute", py_object_type, (py_object_type, ), 0],
+      "divmod":  ["PyNumber_Divmod", py_object_type, (py_object_type, py_object_type), 0],
+      "pow":     ["PyNumber_Power", py_object_type, (py_object_type, py_object_type, py_object_type), 0],
+#      "int":     ["PyNumber_Int", py_object_type, (py_object_type, ), 0],
+#      "long":    ["PyNumber_Long", py_object_type, (py_object_type, ), 0],
+#      "float":   ["PyNumber_Float", py_object_type, (py_object_type, ), 0],
+
+#      "list":    ["PyNumber_List", py_object_type, (py_object_type, ), 0],
+#      "tuple":   ["PySequence_Tuple", py_object_type, (py_object_type, ), 0],
+
     }
 
 class ModuleScope(Scope):