Cleanup builtin function code
authorRobert Bradshaw <robertwb@math.washington.edu>
Wed, 24 Oct 2007 08:14:41 +0000 (01:14 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Wed, 24 Oct 2007 08:14:41 +0000 (01:14 -0700)
Cython/Compiler/Builtin.py
Cython/Compiler/Symtab.py
Cython/Compiler/TypeSlots.py

index 0d4393ec9f59a98c23eb5da6ded4dcfd72a435c9..eeec02a4a8a9013a4f8d9b89324d70a2c836c411 100644 (file)
@@ -19,14 +19,14 @@ builtin_function_table = [
     #('filter',    "",     "",      ""),
     ('getattr',    "OO",   "O",     "PyObject_GetAttr"),
     ('getattr3',   "OOO",  "O",     "__Pyx_GetAttr3",       "getattr"),
-    ('hasattr',    "OO",   "i",     "PyObject_HasAttr"),
+    ('hasattr',    "OO",   "b",     "PyObject_HasAttr"),
     ('hash',       "O",    "i",     "PyObject_Hash"),
     #('hex',       "",     "",      ""),
     #('id',        "",     "",      ""),
     #('input',     "",     "",      ""),
     ('intern',     "s",    "O",     "PyString_InternFromString"),
-    ('isinstance', "OO",   "i",     "PyObject_IsInstance"),
-    ('issubclass', "OO",   "i",     "PyObject_IsSubclass"),
+    ('isinstance', "OO",   "b",     "PyObject_IsInstance"),
+    ('issubclass', "OO",   "b",     "PyObject_IsSubclass"),
     ('iter',       "O",    "O",     "PyObject_GetIter"),
     ('len',        "O",    "Z",     "PyObject_Length"),
     #('map',       "",     "",      ""),
index 65f9a11ca6961878a55f6f013b813dbfbaee57cd..7c18055fdf6fe89c20476fd7bfbcbec8a6c5e1ed 100644 (file)
@@ -606,20 +606,7 @@ class BuiltinScope(Scope):
       "unicode": ["PyObject_Unicode", py_object_type, (py_object_type, ), 0],
       "type":    ["PyObject_Type", py_object_type, (py_object_type, ), 0],
 
-      "hasattr": ["PyObject_HasAttr", c_bint_type, (py_object_type, py_object_type)],
-      "setattr": ["PyObject_SetAttr", c_int_type, (py_object_type, py_object_type, py_object_type), -1],
-      "repr":    ["PyObject_Repr", py_object_type, (py_object_type, ), 0],
 #      "str":     ["PyObject_Str", py_object_type, (py_object_type, ), 0],
-      "isinstance": ["PyObject_IsInstance", c_bint_type, (py_object_type, py_object_type), -1],
-      "issubclass": ["PyObject_IsSubclass", c_bint_type, (py_object_type, py_object_type), -1],
-      "hash":    ["PyObject_Hash", c_long_type, (py_object_type, ), -1, True],
-      "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],
-
-      "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],
index e7edf053633f18e90c34a6863cf5a108c4329c3a..87a191aea18a924c54aa07dd17b55e67027dce65 100644 (file)
@@ -42,6 +42,7 @@ class Signature:
         'p': PyrexTypes.c_void_ptr_type,
         'P': PyrexTypes.c_void_ptr_ptr_type,
         'i': PyrexTypes.c_int_type,
+        'b': PyrexTypes.c_bint_type,
         'I': PyrexTypes.c_int_ptr_type,
         'l': PyrexTypes.c_long_type,
         'Z': PyrexTypes.c_py_ssize_t_type,
@@ -53,10 +54,12 @@ class Signature:
     }
     
     error_value_map = {
-        'O': "0",
+        'O': "NULL",
         'i': "-1",
+        'b': "-1",
         'l': "-1",
         'r': "-1",
+        'Z': "-1",
     }
     
     def __init__(self, arg_format, ret_format):