Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
small changes
  • Loading branch information
brijkapadia committed Jul 8, 2026
commit 3be6705523a6a2b54570c4873652143e119dd711
1 change: 1 addition & 0 deletions Include/internal/pycore_dict.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ struct _dictkeysobject {
} dk_entries;
};

/* The _dictkeysobject is allocated directly afterwards */
struct _instancekeysobject {
PyTypeObject* dsk_owning_type;
};
Expand Down
11 changes: 4 additions & 7 deletions Objects/dictobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,8 +857,7 @@
dk->dk_nentries = 0;
dk->dk_usable = usable;
dk->dk_version = 0;
size_t indices_size = (size_t)1 << log2_bytes;
memset(_DK_INDICES(dk), 0xff, indices_size);
memset(_DK_INDICES(dk), 0xff, ((size_t)1 << log2_bytes));
memset(_DK_ENTRIES(dk), 0, entry_size * usable);
}

Expand Down Expand Up @@ -7282,22 +7281,20 @@
{
int log2_bytes = get_log2_bytes(NEXT_LOG2_SHARED_KEYS_MAX_SIZE);
Py_ssize_t usable = USABLE_FRACTION((size_t)1<<NEXT_LOG2_SHARED_KEYS_MAX_SIZE);
size_t indices_size = (size_t)1 << log2_bytes;
size_t keys_size = sizeof(PyDictKeysObject) - sizeof(PyDictKeyEntry)
+ sizeof(PyDictUnicodeEntry) * usable;

struct _instancekeysobject *shared_keys =
PyMem_Malloc(sizeof(struct _instancekeysobject)
+ indices_size
+ keys_size);
+ ((size_t)1 << log2_bytes)
+ sizeof(PyDictKeysObject) - sizeof(PyDictKeyEntry)
+ sizeof(PyDictUnicodeEntry) * usable);
if (shared_keys == NULL) {
PyErr_Clear();
return NULL;
}

shared_keys->dsk_owning_type = (PyTypeObject *)cls;
PyDictKeysObject* keys = _DK_FROM_BASE((char *)shared_keys + sizeof(struct _instancekeysobject),

Check failure on line 7296 in Objects/dictobject.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (x64, tail-call)

'indices_size': undeclared identifier [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 7296 in Objects/dictobject.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (x64, switch-case)

'indices_size': undeclared identifier [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 7296 in Objects/dictobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (x64, tail-call)

'indices_size': undeclared identifier [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 7296 in Objects/dictobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (x64, switch-case)

'indices_size': undeclared identifier [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 7296 in Objects/dictobject.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (arm64, switch-case)

'indices_size': undeclared identifier [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 7296 in Objects/dictobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (arm64, switch-case)

'indices_size': undeclared identifier [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]
indices_size);

Check failure on line 7297 in Objects/dictobject.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

‘indices_size’ undeclared (first use in this function)

Check failure on line 7297 in Objects/dictobject.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

‘indices_size’ undeclared (first use in this function)

Check failure on line 7297 in Objects/dictobject.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-26.04)

‘indices_size’ undeclared (first use in this function)

Check failure on line 7297 in Objects/dictobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-26.04-arm)

‘indices_size’ undeclared (first use in this function)

Check failure on line 7297 in Objects/dictobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-26.04-arm)

‘indices_size’ undeclared (first use in this function)

Check failure on line 7297 in Objects/dictobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-26.04)

‘indices_size’ undeclared (first use in this function)

Check failure on line 7297 in Objects/dictobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-26.04)

‘indices_size’ undeclared (first use in this function)

Check failure on line 7297 in Objects/dictobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-26.04)

‘indices_size’ undeclared (first use in this function)
init_keys_object(keys, NEXT_LOG2_SHARED_KEYS_MAX_SIZE, log2_bytes, DICT_KEYS_SPLIT,
SHARED_KEYS_MAX_SIZE, sizeof(PyDictUnicodeEntry));
assert(keys->dk_nentries == 0);
Expand Down
Loading