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 rhettinger
Recipients rhettinger, ronaldoussoren, scoder, serhiy.storchaka
Date 2019-02-11.02:46:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1549853194.63.0.373966620797.issue35460@roundup.psfhosted.org>
In-reply-to
Content
-1 for expanding this API.  As Serhiy pointed-out, PyDict_GetItemString() is an old API kept just for backward compatibility.  For your use case, it is easy to call PyUnicode_FromString(key) and then follow-up with PyDict_GetItemWithError().  The latter way is more flexible in that it allows you to cache the unicode object for future use (something you're going to want to do if you care about performance).  The latter way also lets you intern the string as well.

FWIW, if it is only your own code, it is trivially easy to write your own helper function if that is what you needed for a single porting project.  IMO, unnecessarily adding to many variants of the same function just makes the API harder to learn (see all the ObjectCall variants for example) and makes the code harder for us to maintain.  ISTM most of the concrete APIs are deliberately sparse, so adding this variant would be a change in the philosophy of the C-API.  Also, we mostly want people to use the abstract API unless they know for sure that a target dictionary is an exact dict (this has been an outstanding problem for OrderedDicts for example).
History
Date User Action Args
2019-02-11 02:46:36rhettingersetrecipients: + rhettinger, ronaldoussoren, scoder, serhiy.storchaka
2019-02-11 02:46:34rhettingersetmessageid: <1549853194.63.0.373966620797.issue35460@roundup.psfhosted.org>
2019-02-11 02:46:34rhettingerlinkissue35460 messages
2019-02-11 02:46:34rhettingercreate