Author: Antonio Cuni <[email protected]>
Branch: fastjson
Changeset: r64837:d0a3ae2d5a74
Date: 2013-06-07 17:58 +0200
http://bitbucket.org/pypy/pypy/changeset/d0a3ae2d5a74/

Log:    there is no need to check for the bound, as there is the sentinel at
        the end of the string anyway. Morever, avoid to keep a separate
        counter

diff --git a/pypy/module/_fastjson/interp_decoder.py 
b/pypy/module/_fastjson/interp_decoder.py
--- a/pypy/module/_fastjson/interp_decoder.py
+++ b/pypy/module/_fastjson/interp_decoder.py
@@ -182,15 +182,15 @@
         "Parse a sequence of digits as a decimal number. No sign allowed"
         intval = 0
         count = 0
-        i = self.pos
-        while i < self.length:
+        start = i = self.pos
+        while True:
             ch = self.ll_chars[i]
             if ch.isdigit():
                 intval = intval*10 + ord(ch)-ord('0')
-                count += 1
                 i += 1
             else:
                 break
+        count = i - start
         if count == 0:
             self._raise("Expected digit at char %d", i)
         self.pos = i
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to