Author: Tyler Wade <[email protected]>
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
# ____________________________________________________________
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit