[issue42152] Use PyDict_Contains() and PyDict_SetDefault() instead of PyDict_GetItemWithError()

2021-04-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Sure. Thanks for reminder. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ _

[issue42152] Use PyDict_Contains() and PyDict_SetDefault() instead of PyDict_GetItemWithError()

2021-04-13 Thread Inada Naoki
Inada Naoki added the comment: May I close this issue? -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: ht

[issue42152] Use PyDict_Contains() and PyDict_SetDefault() instead of PyDict_GetItemWithError()

2020-10-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset b510e101f8b5b31276bf97b921ca9247162881d2 by Serhiy Storchaka in branch 'master': bpo-42152: Use PyDict_Contains and PyDict_SetDefault if appropriate. (GH-22986) https://github.com/python/cpython/commit/b510e101f8b5b31276bf97b921ca9247162881d2

[issue42152] Use PyDict_Contains() and PyDict_SetDefault() instead of PyDict_GetItemWithError()

2020-10-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The code uses also _PyDict_ContainsId() added in issue42006 instead of _PyDict_GetItemIdWithError(). Few uses of _PyDict_GetItemStringWithError() are left as is. I do not think it is worth to introduce _PyDict_ContainsString(). They could be rewritten usin

[issue42152] Use PyDict_Contains() and PyDict_SetDefault() instead of PyDict_GetItemWithError()

2020-10-26 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +21900 stage: -> patch review pull_request: https://github.com/python/cpython/pull/22986 ___ Python tracker ___

[issue42152] Use PyDict_Contains() and PyDict_SetDefault() instead of PyDict_GetItemWithError()

2020-10-26 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : It was common to use the code PyDict_GetItem(dict, key) == NULL to check whether the key is in the dict. PyDict_GetItem() returns borrowed reference, so no clean up is needed. And if we need to check only existence of the key, we do not need to store a v