Author: Armin Rigo <ar...@tunes.org>
Branch: 
Changeset: r79908:0d6164b07b67
Date: 2015-09-30 16:45 +0200
http://bitbucket.org/pypy/pypy/changeset/0d6164b07b67/

Log:    Fix for the case of a slice(5, sys.maxint) if 5 is greater than
        'length'

diff --git a/pypy/objspace/std/sliceobject.py b/pypy/objspace/std/sliceobject.py
--- a/pypy/objspace/std/sliceobject.py
+++ b/pypy/objspace/std/sliceobject.py
@@ -239,13 +239,16 @@
     # hack for the JIT, for slices with no end specified:
     # this avoids the two comparisons that follow
     if jit.isconstant(stop) and stop == sys.maxint:
-        return start, length
-    if stop < start:
-        stop = start
-    if stop > length:
-        stop = length
-        if jit.isconstant(start) and start == 0:
-            pass    # no need to do the following check here
-        elif start > length:
-            start = length
+        pass
+    else:
+        if stop < start:
+            stop = start
+        if stop <= length:
+            return start, stop
+    # here is the case where 'stop' is larger than the list
+    stop = length
+    if jit.isconstant(start) and start == 0:
+        pass    # no need to do the following check here
+    elif start > stop:
+        start = stop
     return start, stop
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to