[pypy-commit] pypy default: Revert 3b13b7c4c388 through 029ef1dd4a1a: this may look like a good
arigo
noreply at buildbot.pypy.org
Thu Mar 29 13:15:56 CEST 2012
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r54059:516cbe7d60c0
Date: 2012-03-29 13:15 +0200
http://bitbucket.org/pypy/pypy/changeset/516cbe7d60c0/
Log: Revert 3b13b7c4c388 through 029ef1dd4a1a: this may look like a good
idea, but it creates a new path for the JIT, which is problematic in
some cases. Reverting unless further discussion justifies it.
diff --git a/pypy/rpython/lltypesystem/rstr.py b/pypy/rpython/lltypesystem/rstr.py
--- a/pypy/rpython/lltypesystem/rstr.py
+++ b/pypy/rpython/lltypesystem/rstr.py
@@ -765,8 +765,7 @@
def _ll_stringslice(s1, start, stop):
lgt = stop - start
assert start >= 0
- if lgt <= 0:
- return s1.empty()
+ assert lgt >= 0
newstr = s1.malloc(lgt)
s1.copy_contents(s1, newstr, start, 0, lgt)
return newstr
diff --git a/pypy/rpython/ootypesystem/rstr.py b/pypy/rpython/ootypesystem/rstr.py
--- a/pypy/rpython/ootypesystem/rstr.py
+++ b/pypy/rpython/ootypesystem/rstr.py
@@ -222,8 +222,6 @@
length = s.ll_strlen()
if stop > length:
stop = length
- if start > stop:
- start = stop
return s.ll_substring(start, stop-start)
def ll_stringslice_minusone(s):
diff --git a/pypy/rpython/test/test_rstr.py b/pypy/rpython/test/test_rstr.py
--- a/pypy/rpython/test/test_rstr.py
+++ b/pypy/rpython/test/test_rstr.py
@@ -477,11 +477,7 @@
s1 = s[:3]
s2 = s[3:]
s3 = s[3:10]
- s4 = s[42:44]
- return (s1+s2 == s and
- s2+s1 == const('lohel') and
- s1+s3 == s and
- s4 == const(''))
+ return s1+s2 == s and s2+s1 == const('lohel') and s1+s3 == s
res = self.interpret(fn, [0])
assert res
More information about the pypy-commit
mailing list