Commit 5e702a5e authored by Stefan Behnel's avatar Stefan Behnel

fix return type of repr(): CPython guarantees to return str

parent 046d77d9
...@@ -215,7 +215,7 @@ builtin_function_table = [ ...@@ -215,7 +215,7 @@ builtin_function_table = [
#('raw_input', "", "", ""), #('raw_input', "", "", ""),
#('reduce', "", "", ""), #('reduce', "", "", ""),
BuiltinFunction('reload', "O", "O", "PyImport_ReloadModule"), BuiltinFunction('reload', "O", "O", "PyImport_ReloadModule"),
BuiltinFunction('repr', "O", "O", "PyObject_Repr", builtin_return_type='basestring'), BuiltinFunction('repr', "O", "O", "PyObject_Repr", builtin_return_type='str'),
#('round', "", "", ""), #('round', "", "", ""),
BuiltinFunction('setattr', "OOO", "r", "PyObject_SetAttr"), BuiltinFunction('setattr', "OOO", "r", "PyObject_SetAttr"),
#('sum', "", "", ""), #('sum', "", "", ""),
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
cdef int f() except -1: cdef int f() except -1:
cdef object x, y = 0, z = 0, w = 0 cdef object x, y = 0, z = 0, w = 0
cdef str sstring
cdef basestring sustring
cdef int i cdef int i
x = abs(y) x = abs(y)
delattr(x, 'spam') delattr(x, 'spam')
...@@ -20,6 +22,8 @@ cdef int f() except -1: ...@@ -20,6 +22,8 @@ cdef int f() except -1:
x = pow(y, z) x = pow(y, z)
x = reload(y) x = reload(y)
x = repr(y) x = repr(y)
sstring = repr(x)
sustring = repr(x)
setattr(x, y, z) setattr(x, y, z)
#i = typecheck(x, y) #i = typecheck(x, y)
#i = issubtype(x, y) #i = issubtype(x, y)
......
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