[pypy-commit] pypy py3k: Slowly transform string into a bytestring.
amauryfa
noreply at buildbot.pypy.org
Thu Oct 13 01:53:03 CEST 2011
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3k
Changeset: r48011:1e27363024ac
Date: 2011-10-13 01:52 +0200
http://bitbucket.org/pypy/pypy/changeset/1e27363024ac/
Log: Slowly transform string into a bytestring. First step: getitem
return integers!
diff --git a/lib_pypy/binascii.py b/lib_pypy/binascii.py
--- a/lib_pypy/binascii.py
+++ b/lib_pypy/binascii.py
@@ -703,7 +703,7 @@
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')
diff --git a/pypy/objspace/std/stringobject.py b/pypy/objspace/std/stringobject.py
--- a/pypy/objspace/std/stringobject.py
+++ b/pypy/objspace/std/stringobject.py
@@ -839,7 +839,7 @@
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
More information about the pypy-commit
mailing list