bpo-44206: Add a version number to dictionary keys (GH-26333)

* Store log2(size) instead of size in dict-keys.

* Use enum instead of function pointer to record kind of keys.

* Add version number to dict keys.
This commit is contained in:
Mark Shannon 2021-05-28 09:54:10 +01:00 committed by GitHub
parent 8994e9c2cd
commit f8a95df84b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 223 additions and 317 deletions

View file

@ -730,7 +730,7 @@ class PyDictObjectPtr(PyObjectPtr):
def _get_entries(self, keys):
dk_nentries = int(keys['dk_nentries'])
dk_size = int(keys['dk_size'])
dk_size = 1<<int(keys['dk_log2_size'])
try:
# <= Python 3.5
return keys['dk_entries'], dk_size