We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
dk_log2_size=3
1 parent 4f616fe commit 3a3fef4Copy full SHA for 3a3fef4
Objects/dictobject.c
@@ -588,10 +588,13 @@ estimate_log2_keysize(Py_ssize_t n)
588
589
/* This immutable, empty PyDictKeysObject is used for PyDict_Clear()
590
* (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 why dk_log2_size is 3 instead of 0 for empty dicts.
594
*/
595
static PyDictKeysObject empty_keys_struct = {
596
_Py_DICT_IMMORTAL_INITIAL_REFCNT, /* dk_refcnt */
- 0, /* dk_log2_size */
597
+ 3, /* dk_log2_size */
598
0, /* dk_log2_index_bytes */
599
DICT_KEYS_UNICODE, /* dk_kind */
600
#ifdef Py_GIL_DISABLED
0 commit comments