diff options
| author | Raymond Hettinger <python@rcn.com> | 2015-05-13 10:13:28 (GMT) |
|---|---|---|
| committer | Raymond Hettinger <python@rcn.com> | 2015-05-13 10:13:28 (GMT) |
| commit | 77b3ae5e2cfdd7ddacf320dc295f2518c79860e7 (patch) | |
| tree | 29bf6c6006aba7c9be9a19e86976ad6d014177c9 /Objects | |
| parent | bd049190148df537e055f4975db35574448ed0b2 (diff) | |
| download | cpython-77b3ae5e2cfdd7ddacf320dc295f2518c79860e7.zip cpython-77b3ae5e2cfdd7ddacf320dc295f2518c79860e7.tar.gz cpython-77b3ae5e2cfdd7ddacf320dc295f2518c79860e7.tar.bz2 | |
Issue #23971: Fix underestimated presizing in dict.fromkeys()
Diffstat (limited to 'Objects')
| -rw-r--r-- | Objects/dictobject.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 39e7035..50afa3f 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -1361,7 +1361,7 @@ dict_fromkeys(PyObject *cls, PyObject *args) PyObject *key; long hash; - if (dictresize(mp, Py_SIZE(seq))) { + if (dictresize(mp, Py_SIZE(seq) / 2 * 3)) { Py_DECREF(d); return NULL; } @@ -1382,7 +1382,7 @@ dict_fromkeys(PyObject *cls, PyObject *args) PyObject *key; long hash; - if (dictresize(mp, PySet_GET_SIZE(seq))) { + if (dictresize(mp, PySet_GET_SIZE(seq) / 2 * 3)) { Py_DECREF(d); return NULL; } |
