Skip to content

Commit 8ff9fef

Browse files
Revert "update layout comment per pr suggestion"
This reverts commit 27b3fa0.
1 parent 3739870 commit 8ff9fef

2 files changed

Lines changed: 4 additions & 12 deletions

File tree

Include/internal/pycore_dict.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,7 @@ typedef enum {
171171
DICT_KEYS_SPLIT = 2
172172
} DictKeysKind;
173173

174-
/* See dictobject.c for the full DictKeysObject memory layout.
175-
* A PyDictKeysObject* points to the fixed-size header below.
176-
*/
174+
/* See dictobject.c for actual layout of DictKeysObject */
177175
struct _dictkeysobject {
178176
Py_ssize_t dk_refcnt;
179177

@@ -213,8 +211,7 @@ struct _dictkeysobject {
213211
- 4 bytes if dk_size <= 0xffffffff (int32_t*)
214212
- 8 bytes otherwise (int64_t*)
215213
216-
Dynamically sized. This is the start of the variable-sized tail that
217-
immediately follows the fixed-size header. */
214+
Dynamically sized, SIZEOF_VOID_P is minimum. */
218215
char dk_indices[]; /* char is required to avoid strict aliasing. */
219216

220217
/* "PyDictKeyEntry or PyDictUnicodeEntry dk_entries[USABLE_FRACTION(DK_SIZE(dk))];" array follows:

Objects/dictobject.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ As of Python 3.6, this is compact and ordered. Basic idea is described here:
1717
layout:
1818
1919
+---------------------+
20-
| struct _dictkeysobj |
2120
| dk_refcnt |
2221
| dk_log2_size |
2322
| dk_log2_index_bytes |
@@ -26,17 +25,13 @@ As of Python 3.6, this is compact and ordered. Basic idea is described here:
2625
| dk_usable |
2726
| dk_nentries |
2827
+---------------------+
29-
| dk_indices[] | <-- starts at &dk->dk_indices[0]
28+
| dk_indices[] |
3029
| |
3130
+---------------------+
32-
| dk_entries[] | <-- starts at DK_ENTRIES(dk)
31+
| dk_entries[] |
3332
| |
3433
+---------------------+
3534
36-
A PyDictKeysObject* points to the start of the fixed-size header.
37-
The variable-sized part begins at dk_indices and is followed immediately by
38-
the entry array.
39-
4035
dk_indices is actual hashtable. It holds index in entries, or DKIX_EMPTY(-1)
4136
or DKIX_DUMMY(-2).
4237
Size of indices is dk_size. Type of each index in indices varies with dk_size:

0 commit comments

Comments
 (0)