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 scoder
Recipients scoder
Date 2013-03-01.13:45:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1362145555.76.0.784733003054.issue17327@psf.upfronthosting.co.za>
In-reply-to
Content
The functionality of dict.setdefault() is not currently available through the C-API. Specfically, there is no way to test for a key and insert a fallback value for it without evaluating the hash function twice.

The attached patch adds a new C-API function PyDict_GetItemSetDefault() that makes this feature available. Like all PyDict_Getitem*() functions, it returns a borrowed reference.

I hope I got the update in refcounts.dat right. I have no idea how to express that a function *may* increase the refcounts of its arguments.
History
Date User Action Args
2013-03-01 13:45:55scodersetrecipients: + scoder
2013-03-01 13:45:55scodersetmessageid: <1362145555.76.0.784733003054.issue17327@psf.upfronthosting.co.za>
2013-03-01 13:45:55scoderlinkissue17327 messages
2013-03-01 13:45:55scodercreate