1. Pypy
  2. Untitled project
  3. pypy

Commits

Amaury Forgeot d'Arc  committed 1e27363

Slowly transform string into a bytestring.
First step: getitem return integers!

  • Participants
  • Parent commits bfb4fd5
  • Branches py3k

Comments (0)

Files changed (2)

File lib_pypy/binascii.py

View file
  • Ignore whitespace
     def pairs_gen(s):
         while s:
             try:
-                yield table_hex[ord(s[0])], table_hex[ord(s[1])]
+                yield table_hex[s[0]], table_hex[s[1]]
             except IndexError:
                 if len(s):
                     raise TypeError('Odd-length string')

File pypy/objspace/std/stringobject.py

View file
  • Ignore whitespace
     if ival < 0 or ival >= slen:
         raise OperationError(space.w_IndexError,
                              space.wrap("string index out of range"))
-    return wrapchar(space, str[ival])
+    return space.wrap(ord(str[ival]))
 
 def getitem__String_Slice(space, w_str, w_slice):
     w = space.wrap