From d6c61a46751567bcd63249c9a906dfa3f8ce26ed Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Wed, 24 Oct 2007 01:14:41 -0700 Subject: [PATCH] Cleanup builtin function code --- Cython/Compiler/Builtin.py | 6 +++--- Cython/Compiler/Symtab.py | 13 ------------- Cython/Compiler/TypeSlots.py | 5 ++++- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/Cython/Compiler/Builtin.py b/Cython/Compiler/Builtin.py index 0d4393ec..eeec02a4 100644 --- a/Cython/Compiler/Builtin.py +++ b/Cython/Compiler/Builtin.py @@ -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', "", "", ""), diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py index 65f9a11c..7c18055f 100644 --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@ -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], diff --git a/Cython/Compiler/TypeSlots.py b/Cython/Compiler/TypeSlots.py index e7edf053..87a191ae 100644 --- a/Cython/Compiler/TypeSlots.py +++ b/Cython/Compiler/TypeSlots.py @@ -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): -- 2.26.2