[pypy-commit] pypy stdlib-2.7.9: Avoid resizing the list passed to space.newset()

amauryfa noreply at buildbot.pypy.org
Tue Feb 10 23:41:45 CET 2015


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: stdlib-2.7.9
Changeset: r75824:ee0c5e8894ed
Date: 2015-02-10 23:40 +0100
http://bitbucket.org/pypy/pypy/changeset/ee0c5e8894ed/

Log:	Avoid resizing the list passed to space.newset()

diff --git a/pypy/module/_ssl/interp_win32.py b/pypy/module/_ssl/interp_win32.py
--- a/pypy/module/_ssl/interp_win32.py
+++ b/pypy/module/_ssl/interp_win32.py
@@ -90,13 +90,12 @@
                     return space.w_True
                 raise wrap_windowserror(space, last_error)
 
-            result_w = []
+            result_w = [None] * usage.c_cUsageIdentifier
             for i in range(usage.c_cUsageIdentifier):
                 if not usage.c_rgpszUsageIdentifier[i]:
                     continue
-                result_w.append(
-                    space.wrap(rffi.charp2str(
-                        usage.c_rgpszUsageIdentifier[i])))
+                result_w[i] = space.wrap(rffi.charp2str(
+                    usage.c_rgpszUsageIdentifier[i]))
             return space.newset(result_w)
 
 @unwrap_spec(store_name=str)


More information about the pypy-commit mailing list