Skip to content

bpo-42006: Stop using PyDict_GetItem, PyDict_GetItemString and _PyDict_GetItemId.#22648

Merged
serhiy-storchaka merged 5 commits into
python:masterfrom
serhiy-storchaka:capi-dont-use-PyDict_GetItem
Oct 26, 2020
Merged

bpo-42006: Stop using PyDict_GetItem, PyDict_GetItemString and _PyDict_GetItemId.#22648
serhiy-storchaka merged 5 commits into
python:masterfrom
serhiy-storchaka:capi-dont-use-PyDict_GetItem

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Oct 11, 2020

Copy link
Copy Markdown
Member

These functions are considered not safe because they suppress all internal errors and can return wrong result. PyDict_GetItemString and _PyDict_GetItemId can also silence current exception in rare cases.

https://bugs.python.org/issue42006

…t_GetItemId.

These functions are considered not safe because they suppress all internal errors
and can return wrong result.  PyDict_GetItemString and _PyDict_GetItemId can
also silence current exception in rare cases.
@serhiy-storchaka serhiy-storchaka force-pushed the capi-dont-use-PyDict_GetItem branch from e2cbee1 to cd49ec3 Compare October 11, 2020 15:41
@serhiy-storchaka serhiy-storchaka marked this pull request as ready for review October 24, 2020 17:55

@methane methane left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@serhiy-storchaka serhiy-storchaka merged commit fb5db7e into python:master Oct 26, 2020
@serhiy-storchaka serhiy-storchaka deleted the capi-dont-use-PyDict_GetItem branch October 26, 2020 06:43
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
…t_GetItemId. (pythonGH-22648)

These functions are considered not safe because they suppress all internal errors
and can return wrong result.  PyDict_GetItemString and _PyDict_GetItemId can
also silence current exception in rare cases.

Remove no longer used _PyDict_GetItemId.
Add _PyDict_ContainsId and rename _PyDict_Contains into
_PyDict_Contains_KnownHash.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants