Commits

Benjamin Peterson  committed 49edece

add comment

  • Participants
  • Parent commits 2f888f9

Comments (0)

Files changed (2)

File pypy/rpython/lltypesystem/rstr.py

     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)

File pypy/rpython/ootypesystem/rstr.py

         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)