Issue #29019: Fix dict.fromkeys(x) overallocates when x is sparce dict.
Original patch by Rasmus Villemoes.
This commit is contained in:
parent
a535d68ba7
commit
e126f98658
|
@ -13,6 +13,9 @@ Core and Builtins
|
|||
Library
|
||||
-------
|
||||
|
||||
- Issue #29019: Fix dict.fromkeys(x) overallocates when x is sparce dict.
|
||||
Original patch by Rasmus Villemoes.
|
||||
|
||||
- Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and
|
||||
WeakValueDictionary.pop() when a GC collection happens in another
|
||||
thread.
|
||||
|
|
|
@ -1391,7 +1391,7 @@ dict_fromkeys(PyObject *cls, PyObject *args)
|
|||
PyObject *key;
|
||||
long hash;
|
||||
|
||||
if (dictresize(mp, Py_SIZE(seq) / 2 * 3)) {
|
||||
if (dictresize(mp, ((PyDictObject *)seq)->ma_used / 2 * 3)) {
|
||||
Py_DECREF(d);
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue