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.

classification
Title: C API of OrderedDict
Type: Stage: resolved
Components: Interpreter Core Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: brett.cannon, eric.snow, rhettinger, serhiy.storchaka
Priority: normal Keywords: patch

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:41adminsetgithub: 73270
2017-12-25 07:41:02serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-12-25 07:40:29serhiy.storchakasetmessages: + msg309030
2017-12-25 00:08:59python-devsetpull_requests: + pull_request4896
2017-12-25 00:08:45serhiy.storchakasetmessages: + msg309020
2017-12-16 08:37:05rhettingersetmessages: + msg308463
2017-12-16 08:02:14serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request4795
2017-10-23 17:16:05serhiy.storchakasetassignee: serhiy.storchaka
2017-01-22 16:14:54serhiy.storchakasetmessages: + msg286014
2016-12-28 14:37:39rhettingersetmessages: + msg284175
2016-12-27 16:57:36brett.cannonsetnosy: + brett.cannon
messages: + msg284115
2016-12-27 13:59:17serhiy.storchakacreate