Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-94808: Improve coverage of dictresize #100619

Merged
merged 1 commit into from
Dec 31, 2022

Conversation

tqxia
Copy link
Contributor

@tqxia tqxia commented Dec 30, 2022

Try to improve test coverage for Objects/dictobject.c, adding the case "converting a split table into a generic combined table".

Code covered:

cpython/Objects/dictobject.c

Lines 1439 to 1452 in 894f2c3

if (mp->ma_keys->dk_kind == DICT_KEYS_GENERAL) {
// split -> generic
PyDictKeyEntry *newentries = DK_ENTRIES(mp->ma_keys);
for (Py_ssize_t i = 0; i < numentries; i++) {
int index = get_index_from_order(mp, i);
PyDictUnicodeEntry *ep = &oldentries[index];
assert(oldvalues->values[index] != NULL);
newentries[i].me_key = Py_NewRef(ep->me_key);
newentries[i].me_hash = unicode_get_hash(ep->me_key);
newentries[i].me_value = oldvalues->values[index];
}
build_indices_generic(mp->ma_keys, newentries, numentries);
}

Issue:
#94808

@bedevere-bot
Copy link

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

@bedevere-bot bedevere-bot added the tests Tests in the Lib/test dir label Dec 30, 2022
@cpython-cla-bot
Copy link

cpython-cla-bot bot commented Dec 30, 2022

All commit authors signed the Contributor License Agreement.
CLA signed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants