[pypy-commit] pypy utf8-unicode2: Use an iterator here so its O(n)
waedt
noreply at buildbot.pypy.org
Sat Sep 6 22:45:13 CEST 2014
Author: Tyler Wade <wayedt at gmail.com>
Branch: utf8-unicode2
Changeset: r73351:4c43dd3a4c7b
Date: 2014-08-29 01:23 -0500
http://bitbucket.org/pypy/pypy/changeset/4c43dd3a4c7b/
Log: Use an iterator here so its O(n)
diff --git a/pypy/module/_codecs/interp_codecs.py b/pypy/module/_codecs/interp_codecs.py
--- a/pypy/module/_codecs/interp_codecs.py
+++ b/pypy/module/_codecs/interp_codecs.py
@@ -625,9 +625,10 @@
def charmap_build(space, chars):
# XXX CPython sometimes uses a three-level trie
w_charmap = space.newdict()
- for num in range(len(chars)):
- elem = chars[num]
+ num = 0
+ for elem in chars:
space.setitem(w_charmap, space.newint(utf8ord(elem)), space.newint(num))
+ num += 1
return w_charmap
# ____________________________________________________________
More information about the pypy-commit
mailing list