[pypy-commit] pypy rw-PyString_AS_STRING: translation fix

mattip pypy.commits at gmail.com
Thu Jun 16 12:11:41 EDT 2016


Author: Matti Picus <matti.picus at gmail.com>
Branch: rw-PyString_AS_STRING
Changeset: r85193:c62ce292c86c
Date: 2016-06-16 19:06 +0300
http://bitbucket.org/pypy/pypy/changeset/c62ce292c86c/

Log:	translation fix

diff --git a/pypy/module/cpyext/bytesobject.py b/pypy/module/cpyext/bytesobject.py
--- a/pypy/module/cpyext/bytesobject.py
+++ b/pypy/module/cpyext/bytesobject.py
@@ -219,10 +219,10 @@
     set to NULL, a memory exception is set, and -1 is returned.
     """
     # XXX always create a new string so far
-    py_str = rffi.cast(PyStringObject, ref[0])
-    if pyobj_has_w_obj(py_str):
+    if pyobj_has_w_obj(ref[0]):
         raise oefmt(space.w_SystemError,
                     "_PyString_Resize called on already created string")
+    py_str = rffi.cast(PyStringObject, ref[0])
     try:
         py_newstr = new_empty_str(space, newsize)
     except MemoryError:


More information about the pypy-commit mailing list