Commit d6c61a46 authored by Robert Bradshaw's avatar Robert Bradshaw

Cleanup builtin function code

parent 7c2bddc1
...@@ -19,14 +19,14 @@ builtin_function_table = [ ...@@ -19,14 +19,14 @@ builtin_function_table = [
#('filter', "", "", ""), #('filter', "", "", ""),
('getattr', "OO", "O", "PyObject_GetAttr"), ('getattr', "OO", "O", "PyObject_GetAttr"),
('getattr3', "OOO", "O", "__Pyx_GetAttr3", "getattr"), ('getattr3', "OOO", "O", "__Pyx_GetAttr3", "getattr"),
('hasattr', "OO", "i", "PyObject_HasAttr"), ('hasattr', "OO", "b", "PyObject_HasAttr"),
('hash', "O", "i", "PyObject_Hash"), ('hash', "O", "i", "PyObject_Hash"),
#('hex', "", "", ""), #('hex', "", "", ""),
#('id', "", "", ""), #('id', "", "", ""),
#('input', "", "", ""), #('input', "", "", ""),
('intern', "s", "O", "PyString_InternFromString"), ('intern', "s", "O", "PyString_InternFromString"),
('isinstance', "OO", "i", "PyObject_IsInstance"), ('isinstance', "OO", "b", "PyObject_IsInstance"),
('issubclass', "OO", "i", "PyObject_IsSubclass"), ('issubclass', "OO", "b", "PyObject_IsSubclass"),
('iter', "O", "O", "PyObject_GetIter"), ('iter', "O", "O", "PyObject_GetIter"),
('len', "O", "Z", "PyObject_Length"), ('len', "O", "Z", "PyObject_Length"),
#('map', "", "", ""), #('map', "", "", ""),
......
...@@ -606,20 +606,7 @@ class BuiltinScope(Scope): ...@@ -606,20 +606,7 @@ class BuiltinScope(Scope):
"unicode": ["PyObject_Unicode", py_object_type, (py_object_type, ), 0], "unicode": ["PyObject_Unicode", py_object_type, (py_object_type, ), 0],
"type": ["PyObject_Type", 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], # "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], # "int": ["PyNumber_Int", py_object_type, (py_object_type, ), 0],
# "long": ["PyNumber_Long", 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], # "float": ["PyNumber_Float", py_object_type, (py_object_type, ), 0],
......
...@@ -42,6 +42,7 @@ class Signature: ...@@ -42,6 +42,7 @@ class Signature:
'p': PyrexTypes.c_void_ptr_type, 'p': PyrexTypes.c_void_ptr_type,
'P': PyrexTypes.c_void_ptr_ptr_type, 'P': PyrexTypes.c_void_ptr_ptr_type,
'i': PyrexTypes.c_int_type, 'i': PyrexTypes.c_int_type,
'b': PyrexTypes.c_bint_type,
'I': PyrexTypes.c_int_ptr_type, 'I': PyrexTypes.c_int_ptr_type,
'l': PyrexTypes.c_long_type, 'l': PyrexTypes.c_long_type,
'Z': PyrexTypes.c_py_ssize_t_type, 'Z': PyrexTypes.c_py_ssize_t_type,
...@@ -53,10 +54,12 @@ class Signature: ...@@ -53,10 +54,12 @@ class Signature:
} }
error_value_map = { error_value_map = {
'O': "0", 'O': "NULL",
'i': "-1", 'i': "-1",
'b': "-1",
'l': "-1", 'l': "-1",
'r': "-1", 'r': "-1",
'Z': "-1",
} }
def __init__(self, arg_format, ret_format): def __init__(self, arg_format, ret_format):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment