8000 bpo-40575: Avoid unnecessary overhead in _PyDict_GetItemIdWithError() by scoder · Pull Request #20018 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-40575: Avoid unnecessary overhead in _PyDict_GetItemIdWithError() #20018

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

Merged
Merged
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
Apply suggestions from code review
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
  • Loading branch information
scoder and methane authored May 11, 2020
commit c7e07c32d815ddd5fbe90f444d529690afe734c7
3 changes: 1 addition & 2 deletions Objects/dictobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1488,12 +1488,11 @@ PyDict_GetItemWithError(PyObject *op, PyObject *key)
PyObject *
_PyDict_GetItemIdWithError(PyObject *dp, struct _Py_Identifier *key)
{
Py_hash_t hash;
PyObject *kv;
kv = _PyUnicode_FromId(key); /* borrowed */
if (kv == NULL)
return NULL;
hash = ((PyASCIIObject *) kv)->hash;
Py_hash_t hash = ((PyASCIIObject *) kv)->hash;
assert (hash != -1); /* interned strings have their hash value initialised */
return _PyDict_GetItem_KnownHash(dp, kv, hash);
}
Expand Down
0