[pypy-commit] pypy cpyext-ext: rpython-ify (arigato)
mattip
pypy.commits at gmail.com
Fri Jun 3 06:50:42 EDT 2016
Author: Matti Picus <matti.picus at gmail.com>
Branch: cpyext-ext
Changeset: r84892:47dd7be1ca3f
Date: 2016-06-03 13:48 +0300
http://bitbucket.org/pypy/pypy/changeset/47dd7be1ca3f/
Log: rpython-ify (arigato)
diff --git a/pypy/module/cpyext/bytearrayobject.py b/pypy/module/cpyext/bytearrayobject.py
--- a/pypy/module/cpyext/bytearrayobject.py
+++ b/pypy/module/cpyext/bytearrayobject.py
@@ -98,7 +98,7 @@
@cpython_api([PyObject, PyObject], PyObject)
def PyByteArray_Concat(space, w_left, w_right):
"""Concat bytearrays a and b and return a new bytearray with the result."""
- return space.call_method(w_left, '__add__', w_right)
+ return space.add(w_left, w_right)
@cpython_api([PyObject], Py_ssize_t, error=-1)
def PyByteArray_Size(space, w_obj):
@@ -126,7 +126,7 @@
space.call_method(w_obj, 'extend', space.wrap('\x00' * (newlen - oldlen)))
elif oldlen > newlen:
assert newlen >= 0
- space.delitem(w_obj, space.wrap(slice(newlen, None, 1)))
+ space.delslice(w_obj, space.wrap(newlen), space.wrap(oldlen))
return 0
else:
raise oefmt(space.w_TypeError,
diff --git a/pypy/module/cpyext/unicodeobject.py b/pypy/module/cpyext/unicodeobject.py
--- a/pypy/module/cpyext/unicodeobject.py
+++ b/pypy/module/cpyext/unicodeobject.py
@@ -671,7 +671,7 @@
@cpython_api([PyObject, PyObject], PyObject)
def PyUnicode_Concat(space, w_left, w_right):
"""Concat two strings giving a new Unicode string."""
- return space.call_method(w_left, '__add__', w_right)
+ return space.add(w_left, w_right)
@cpython_api([rffi.CWCHARP, rffi.CWCHARP, Py_ssize_t], lltype.Void)
def Py_UNICODE_COPY(space, target, source, length):
More information about the pypy-commit
mailing list