]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-42152: Use PyDict_Contains and PyDict_SetDefault if appropriate. (GH-22986)
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 26 Oct 2020 10:47:57 +0000 (12:47 +0200)
committerGitHub <noreply@github.com>
Mon, 26 Oct 2020 10:47:57 +0000 (12:47 +0200)
commitb510e101f8b5b31276bf97b921ca9247162881d2
tree582a988d8259c0d92d67fbe739852ea0ec46e4fa
parentfb5db7ec58624cab0797b4050735be865d380823
bpo-42152: Use PyDict_Contains and PyDict_SetDefault if appropriate. (GH-22986)

If PyDict_GetItemWithError is only used to check whether the key is in dict,
it is better to use PyDict_Contains instead.

And if it is used in combination with PyDict_SetItem, PyDict_SetDefault can
replace the combination.
Modules/_ctypes/_ctypes.c
Modules/_ctypes/callbacks.c
Modules/_pickle.c
Modules/posixmodule.c
Modules/pyexpat.c
Modules/selectmodule.c
Objects/dictobject.c
Objects/typeobject.c
Python/bltinmodule.c
Python/errors.c
Python/import.c