Author: Benjamin Peterson <[email protected]>
Branch: 
Changeset: r54061:49edece70bd7
Date: 2012-03-29 08:43 -0400
http://bitbucket.org/pypy/pypy/changeset/49edece70bd7/

Log:    add comment

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,6 +765,8 @@
     def _ll_stringslice(s1, start, stop):
         lgt = stop - start
         assert start >= 0
+        # If start >= stop, return a empty string. This can happen if the start
+        # is greater than the length of the string.
         if lgt <= 0:
             return s1.empty()
         newstr = s1.malloc(lgt)
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,6 +222,8 @@
         length = s.ll_strlen()
         if stop > length:
             stop = length
+        # If start > stop, return a empty string. This can happen if the start
+        # is greater than the length of the string.
         if start > stop:
             start = stop
         return s.ll_substring(start, stop-start)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to