bpo-44206: Add a version number to dictionary keys by markshannon · Pull Request #26333 · python/cpython · GitHub
Skip to content
Prev Previous commit
Next Next commit
Add version number to dict keys.
  • Loading branch information
markshannon committed May 24, 2021
commit 6ad4bb72000f40e8987c2265fbfbbcdc1a0ce5b1
4 changes: 4 additions & 0 deletions Include/cpython/dictobject.h
3 changes: 3 additions & 0 deletions Objects/dict-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ struct _dictkeysobject {
/* Kind of keys */
uint8_t dk_kind;

/* Version number -- Reset to 0 by any modification to keys */
uint32_t dk_version;

/* Number of usable entries in dk_entries. */
Py_ssize_t dk_usable;

Expand Down
22 changes: 22 additions & 0 deletions Objects/dictobject.c