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 ronaldoussoren
Recipients ronaldoussoren, serhiy.storchaka
Date 2019-02-10.13:05:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1549803900.53.0.666590615641.issue35460@roundup.psfhosted.org>
In-reply-to
Content
Adding PyDict_GetItemStringWithError makes is possible to migrate existing code to a design that does not ignore errors.  I have a significant number of calls to PyDict_GetItemString that cannot be switch toed PyDict_GetItem without increasing the number of lines of C code I have to write (or in other words, if PyDict_GetItemString wouldn't exist I'd have invented this myself for use in extensions I write).

Another reason for adding the function is consistency in the API. 

BTW. I've added a function with the same signature as the proposed PyDict_GetItemStringWithError to my exension's code base, which is something I'd have to do anyway for backward compatibility with older CPython versions.

W.r.t API design: I prefer the interface of _PyObject_LookupAttr to that of PyDict_GetItemWithError, even if the additional cost of a call to PyErr_Occurred() is insignificant in most of my code (esp. when guarded with a test for a NULL return value from PyDict_GetItemWithError).
History
Date User Action Args
2019-02-10 13:05:02ronaldoussorensetrecipients: + ronaldoussoren, serhiy.storchaka
2019-02-10 13:05:00ronaldoussorensetmessageid: <1549803900.53.0.666590615641.issue35460@roundup.psfhosted.org>
2019-02-10 13:05:00ronaldoussorenlinkissue35460 messages
2019-02-10 13:05:00ronaldoussorencreate