[pypy-commit] pypy py3.5: Fix performance and correctness of PyDict_Next by storing a list of keys instead of a view
rlamy
pypy.commits at gmail.com
Mon Oct 9 10:41:19 EDT 2017
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3.5
Changeset: r92681:61c11feab4e6
Date: 2017-10-09 16:40 +0200
http://bitbucket.org/pypy/pypy/changeset/61c11feab4e6/
Log: Fix performance and correctness of PyDict_Next by storing a list of
keys instead of a view
diff --git a/pypy/module/cpyext/dictobject.py b/pypy/module/cpyext/dictobject.py
--- a/pypy/module/cpyext/dictobject.py
+++ b/pypy/module/cpyext/dictobject.py
@@ -274,8 +274,9 @@
if pos == 0:
# Store the current keys in the PyDictObject.
decref(space, py_dict.c__tmpkeys)
- w_keys = space.call_method(space.w_dict, "keys", w_dict)
+ w_keyview = space.call_method(space.w_dict, "keys", w_dict)
# w_keys must use the object strategy in order to keep the keys alive
+ w_keys = space.newlist(space.listview(w_keyview))
w_keys.switch_to_object_strategy()
py_dict.c__tmpkeys = create_ref(space, w_keys)
Py_IncRef(space, py_dict.c__tmpkeys)
More information about the pypy-commit
mailing list