[pypy-commit] pypy cpyext-macros-cast: Fixes: consistently have non-wrapped VOIDP arguments be of

arigo pypy.commits at gmail.com
Sun May 15 03:46:52 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: cpyext-macros-cast
Changeset: r84447:d20a946f71c8
Date: 2016-05-15 09:32 +0200
http://bitbucket.org/pypy/pypy/changeset/d20a946f71c8/

Log:	Fixes: consistently have non-wrapped VOIDP arguments be of type
	VOIDP, also in callers

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
@@ -189,10 +189,10 @@
     return runicode.UNICHR(runicode.MAXUNICODE)
 
 @cpython_api([rffi.VOIDP], rffi.CCHARP, error=CANNOT_FAIL)
-def PyUnicode_AS_DATA(space, w_obj):
+def PyUnicode_AS_DATA(space, ref):
     """Return a pointer to the internal buffer of the object. o has to be a
     PyUnicodeObject (not checked)."""
-    return rffi.cast(rffi.CCHARP, PyUnicode_AS_UNICODE(space, w_obj))
+    return rffi.cast(rffi.CCHARP, PyUnicode_AS_UNICODE(space, ref))
 
 @cpython_api([rffi.VOIDP], Py_ssize_t, error=CANNOT_FAIL)
 def PyUnicode_GET_DATA_SIZE(space, w_obj):
@@ -227,7 +227,7 @@
     w_type = from_ref(space, rffi.cast(PyObject, ref.c_ob_type))
     if not space.is_true(space.issubtype(w_type, space.w_unicode)):
         raise oefmt(space.w_TypeError, "expected unicode object")
-    return PyUnicode_AS_UNICODE(space, ref)
+    return PyUnicode_AS_UNICODE(space, rffi.cast(rffi.VOIDP, ref))
 
 @cpython_api([PyObject], Py_ssize_t, error=-1)
 def PyUnicode_GetSize(space, ref):
@@ -247,7 +247,7 @@
     string may or may not be 0-terminated.  It is the responsibility of the caller
     to make sure that the wchar_t string is 0-terminated in case this is
     required by the application."""
-    c_str = PyUnicode_AS_UNICODE(space, rffi.cast(PyObject, ref))
+    c_str = PyUnicode_AS_UNICODE(space, rffi.cast(rffi.VOIDP, ref))
     c_length = ref.c_length
 
     # If possible, try to copy the 0-termination as well


More information about the pypy-commit mailing list