Skip to content

Commit f164f24

Browse files
committed
use dk_log2_index_bytes=3 in empty dicts
1 parent 4f616fe commit f164f24

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Objects/dictobject.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,11 +588,14 @@ estimate_log2_keysize(Py_ssize_t n)
588588

589589
/* This immutable, empty PyDictKeysObject is used for PyDict_Clear()
590590
* (which cannot fail and thus can do no allocation).
591+
*
592+
* See https://github.com/python/cpython/pull/127568#discussion_r1868070614
593+
* for the rationale of using dk_log2_index_bytes=3 instead of 0.
591594
*/
592595
static PyDictKeysObject empty_keys_struct = {
593596
_Py_DICT_IMMORTAL_INITIAL_REFCNT, /* dk_refcnt */
594597
0, /* dk_log2_size */
595-
0, /* dk_log2_index_bytes */
598+
3, /* dk_log2_index_bytes */
596599
DICT_KEYS_UNICODE, /* dk_kind */
597600
#ifdef Py_GIL_DISABLED
598601
{0}, /* dk_mutex */

0 commit comments

Comments
 (0)