[pypy-svn] r71794 - pypy/trunk/pypy/rpython/lltypesystem

arigo at codespeak.net arigo at codespeak.net
Fri Mar 5 13:38:15 CET 2010


Author: arigo
Date: Fri Mar  5 13:38:14 2010
New Revision: 71794

Modified:
   pypy/trunk/pypy/rpython/lltypesystem/rstr.py
Log:
Can't do that.  You are mutating the string passed as an argument!
Revert this part of r71772.

(Incidentally, r71784 is a pointless revert because non-JITted
pypy-c's fail in the same way.  My guess is that the cause was
really r71772.)


Modified: pypy/trunk/pypy/rpython/lltypesystem/rstr.py
==============================================================================
--- pypy/trunk/pypy/rpython/lltypesystem/rstr.py	(original)
+++ pypy/trunk/pypy/rpython/lltypesystem/rstr.py	Fri Mar  5 13:38:14 2010
@@ -18,7 +18,6 @@
 from pypy.rpython.rmodel import Repr
 from pypy.rpython.lltypesystem import llmemory
 from pypy.tool.sourcetools import func_with_new_name
-from pypy.rlib import rgc
 
 # ____________________________________________________________
 #
@@ -682,9 +681,10 @@
     @purefunction
     def ll_stringslice_minusone(s1):
         newlen = len(s1.chars) - 1
+        newstr = s1.malloc(newlen)
         assert newlen >= 0
-        return rgc.ll_shrink_array(s1, newlen)
-
+        s1.copy_contents(s1, newstr, 0, 0, newlen)
+        return newstr
 
     def ll_split_chr(LIST, s, c):
         chars = s.chars



More information about the Pypy-commit mailing list