[pypy-svn] r73320 - pypy/branch/cpython-extension/pypy/module/cpyext

fijal at codespeak.net fijal at codespeak.net
Sat Apr 3 01:59:48 CEST 2010


Author: fijal
Date: Sat Apr  3 01:59:47 2010
New Revision: 73320

Modified:
   pypy/branch/cpython-extension/pypy/module/cpyext/stringobject.py
Log:
make it do exactly what docstring says


Modified: pypy/branch/cpython-extension/pypy/module/cpyext/stringobject.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/stringobject.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/stringobject.py	Sat Apr  3 01:59:47 2010
@@ -70,7 +70,12 @@
     require changes in your code for properly supporting 64-bit systems."""
     # XXX always create a new string so far
     w_s = from_ref(space, ref[0])
-    ptr = make_ref(space, space.wrap(space.str_w(w_s)[:newsize]))
+    try:
+        ptr = make_ref(space, space.wrap(space.str_w(w_s)[:newsize]))
+    except:
+        Py_DecRef(space, ref[0])
+        ref[0] = lltype.nullptr(PyStringObject) 
+        raise
     Py_DecRef(space, ref[0])
     ref[0] = ptr
     return 0



More information about the Pypy-commit mailing list