This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients ronaldoussoren, serhiy.storchaka
Date 2018-12-11.13:48:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1544536128.55.0.788709270274.issue35460@psf.upfronthosting.co.za>
In-reply-to
Content
PyDict_GetItemString() is an old API from times when dicts could contain only string keys. It is not necessary part of the C API and can be replaced with PyDict_GetItem() in new code. It was kept only as a convenient function.

In issue35459 many uses of PyDict_GetItemString() were replaced with PyDict_GetItemWithError() and private _PyDict_GetItemIdWithError(). Only 4 occurrences were replaced with newly added private _PyDict_GetItemStringWithError(). And they could use PyDict_GetItem(). So there are not much use cases for PyDict_GetItemStringWithError().

Before adding PyDict_GetItemStringWithError() we could consider alternatives.

*WithError() functions require calling PyErr_Occurred() to distinguish the error case from the "not found" case. This adds an overhead which can be not small in performance critical code. It would be better if the API function returned a three-state value: "found", "not found" and "error". See for example _PyObject_LookupAttr(). I am not sure this is the best design.
History
Date User Action Args
2018-12-11 13:48:48serhiy.storchakasetrecipients: + serhiy.storchaka, ronaldoussoren
2018-12-11 13:48:48serhiy.storchakasetmessageid: <1544536128.55.0.788709270274.issue35460@psf.upfronthosting.co.za>
2018-12-11 13:48:48serhiy.storchakalinkissue35460 messages
2018-12-11 13:48:48serhiy.storchakacreate