Issue 29084: C API of OrderedDict (original) (raw)

Created on 2016-12-27 13:59 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 4900 merged serhiy.storchaka,2017-12-16 08:02
PR 5007 merged python-dev,2017-12-25 00:08
Messages (7)
msg284098 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-12-27 13:59
C API of the C implementation of OrderedDict was added in 3.5 together with the C implementation of OrderedDict. But it was never announced nor documented. Some macros contain bugs. PyODict_Check() and PyODict_CheckExact() are declared in the limited API, but don't work since use PyODict_Type not available in the limited API. PyODict_SIZE() is expanded to syntactically incorrect code and it's name is not consistent with similar macros: PyTuple_GET_SIZE, PyList_GET_SIZE and just added PyDict_GET_SIZE. Many names are just transparent wrappers around PyDict API (and they can't be different). Since PyODict C API is not documented, partially not working and partially redundant, and the C implementation of OrderedDict is optional (other Python implementations can provide just Python implementation of OrderedDict), I think this C API should be made private if not removed.
msg284115 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2016-12-27 16:57
If the API is broken in the limited API then I definitely think we should consistently make it not part of the limited API. As for removing it I don't have an opinion without knowing how many people are using it.
msg284175 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2016-12-28 14:37
+1 for privatizing
msg286014 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-01-22 16:14
Eric, what are your thoughts?
msg308463 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2017-12-16 08:37
With today's announcement of guaranteed ordering for regular dicts, OrderedDict just became much less important (almost insignificant). Also, the original reason for having this C API no longer applies. There is a reasonable case to be made for removing the API entirely (given that it was never documented, that it is buggy, and that it is no longer of any significance).
msg309020 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-12-25 00:08
New changeset 1b3029ac8370ac76fa9571aef540e10aed0667ff by Serhiy Storchaka in branch 'master': bpo-29084: Exclude C API for OrderedDict from the limited C API. (#4900) https://github.com/python/cpython/commit/1b3029ac8370ac76fa9571aef540e10aed0667ff
msg309030 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-12-25 07:40
New changeset d62b7412c18bd5dfa6d7346abfaf8a922818e6db by Serhiy Storchaka (Miss Islington (bot)) in branch '3.6': bpo-29084: Exclude C API for OrderedDict from the limited C API. (GH-4900) (#5007) https://github.com/python/cpython/commit/d62b7412c18bd5dfa6d7346abfaf8a922818e6db
History
Date User Action Args
2022-04-11 14:58:41 admin set github: 73270
2017-12-25 07:41:02 serhiy.storchaka set status: open -> closedresolution: fixedstage: patch review -> resolved
2017-12-25 07:40:29 serhiy.storchaka set messages: +
2017-12-25 00:08:59 python-dev set pull_requests: + <pull%5Frequest4896>
2017-12-25 00:08:45 serhiy.storchaka set messages: +
2017-12-16 08:37:05 rhettinger set messages: +
2017-12-16 08:02:14 serhiy.storchaka set keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest4795>
2017-10-23 17:16:05 serhiy.storchaka set assignee: serhiy.storchaka
2017-01-22 16:14:54 serhiy.storchaka set messages: +
2016-12-28 14:37:39 rhettinger set messages: +
2016-12-27 16:57:36 brett.cannon set nosy: + brett.cannonmessages: +
2016-12-27 13:59:17 serhiy.storchaka create