Author: Armin Rigo <ar...@tunes.org>
Branch: unicode-utf8-re
Changeset: r93349:0d4b7b9d28b5
Date: 2017-12-10 08:39 +0100
http://bitbucket.org/pypy/pypy/changeset/0d4b7b9d28b5/

Log:    Kill the wrong comment about r_uint in prev_codepoint_pos

diff --git a/rpython/rlib/rsre/rsre_utf8.py b/rpython/rlib/rsre/rsre_utf8.py
--- a/rpython/rlib/rsre/rsre_utf8.py
+++ b/rpython/rlib/rsre/rsre_utf8.py
@@ -1,6 +1,5 @@
 import sys
 from rpython.rlib.debug import check_nonneg
-from rpython.rlib.rarithmetic import r_uint, intmask
 from rpython.rlib.rsre.rsre_core import AbstractMatchContext, EndOfString
 from rpython.rlib.rsre import rsre_char
 from rpython.rlib.objectmodel import we_are_translated
@@ -39,9 +38,7 @@
     def prev(self, position):
         if position <= 0:
             raise EndOfString
-        upos = r_uint(position)
-        upos = rutf8.prev_codepoint_pos(self._utf8, upos)
-        position = intmask(upos)
+        position = rutf8.prev_codepoint_pos(self._utf8, position)
         assert position >= 0
         return position
 
@@ -53,12 +50,10 @@
         return position
 
     def prev_n(self, position, n, start_position):
-        upos = r_uint(position)
         for i in range(n):
-            if upos <= r_uint(start_position):
+            if position <= start_position:
                 raise EndOfString
-            upos = rutf8.prev_codepoint_pos(self._utf8, upos)
-        position = intmask(upos)
+            position = rutf8.prev_codepoint_pos(self._utf8, position)
         assert position >= 0
         return position
 
diff --git a/rpython/rlib/rutf8.py b/rpython/rlib/rutf8.py
--- a/rpython/rlib/rutf8.py
+++ b/rpython/rlib/rutf8.py
@@ -132,7 +132,7 @@
     """Gives the position of the previous codepoint.
     'pos' must not be zero.
     """
-    pos -= 1 # ruint
+    pos -= 1
     if pos >= len(code):     # for the case where pos - 1 == len(code):
         assert pos >= 0
         return pos           # assume there is an extra '\x00' character
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to