Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r84891:a0a038130dfc
Date: 2016-06-03 12:31 +0200
http://bitbucket.org/pypy/pypy/changeset/a0a038130dfc/

Log:    Tweak: this way seems more natural, and lets the annotator know that
        'i' is never negative.

diff --git a/pypy/objspace/std/bytearrayobject.py 
b/pypy/objspace/std/bytearrayobject.py
--- a/pypy/objspace/std/bytearrayobject.py
+++ b/pypy/objspace/std/bytearrayobject.py
@@ -170,9 +170,8 @@
         hexstring = hexstring.lower()
         data = []
         length = len(hexstring)
-        i = -2
+        i = 0
         while True:
-            i += 2
             while i < length and hexstring[i] == ' ':
                 i += 1
             if i >= length:
@@ -187,6 +186,7 @@
             if bot == -1:
                 raise oefmt(space.w_ValueError, NON_HEX_MSG, i + 1)
             data.append(chr(top*16 + bot))
+            i += 2
 
         # in CPython bytearray.fromhex is a staticmethod, so
         # we ignore w_type and always return a bytearray
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to