[pypy-commit] pypy unquote-faster: avoid extra copy

kostialopuhin noreply at buildbot.pypy.org
Tue Feb 12 14:07:33 CET 2013


Author: Konstantin Lopuhin <kostia.lopuhin at gmail.com>
Branch: unquote-faster
Changeset: r61134:134dddef38b4
Date: 2013-02-12 17:01 +0400
http://bitbucket.org/pypy/pypy/changeset/134dddef38b4/

Log:	avoid extra copy

diff --git a/lib-python/2.7/urllib.py b/lib-python/2.7/urllib.py
--- a/lib-python/2.7/urllib.py
+++ b/lib-python/2.7/urllib.py
@@ -1206,7 +1206,8 @@
     if len(res) == 1:
         return s
     res_list = [res[0]]
-    for item in res[1:]:
+    for j in xrange(1, len(res)):
+        item = res[j]
         try:
             x = _hextochr[item[:2]] + item[2:]
         except KeyError:
diff --git a/lib-python/2.7/urlparse.py b/lib-python/2.7/urlparse.py
--- a/lib-python/2.7/urlparse.py
+++ b/lib-python/2.7/urlparse.py
@@ -322,7 +322,8 @@
     if len(res) == 1:
         return s
     res_list = [res[0]]
-    for item in res[1:]:
+    for j in xrange(1, len(res)):
+        item = res[j]
         try:
             x = _hextochr[item[:2]] + item[2:]
         except KeyError:


More information about the pypy-commit mailing list