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: Convert _decimal C API from pointer array to struct
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.10
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: erlendaasland, facundobatista, mark.dickinson, pitrou, rhettinger, shihai1991, skrah, vstinner
Priority: normal Keywords:

Created on 2021-01-29 09:46 by erlendaasland, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (10)
msg385901 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2021-01-29 09:46
Ref. discussions on bpo-43009 and bpo-41798.
msg386635 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2021-02-08 17:37
Can you explain what problem this would be solving?
msg386645 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2021-02-08 19:29
In my opinion, an array of pointers is a bad API; using a struct (like most of the other API's) is an improvement.

Ref. discussions on GH-24186 (https://github.com/python/cpython/pull/24186#discussion_r560834060) and bpo-43009.
msg387788 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2021-02-27 21:21
> In my opinion, an array of pointers is a bad API;

The existing code is how types were made for most of Python's history.  It is not "bad"; it is just more wordy.  Given that the current code is correct, I don't see any strong reason to churn the code.
msg387938 - (view) Author: Hai Shi (shihai1991) * (Python triager) Date: 2021-03-02 16:51
> It is not "bad"; it is just more wordy.

Agree. Using sturct will be more easy check the members.

But converting the decimal c api may breaks the compatibility, because some macros like `PyDec_TypeCheck_INDEX` have been exposed in headers.
msg387955 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2021-03-02 19:20
> But converting the decimal c api may breaks the compatibility, because some macros like `PyDec_TypeCheck_INDEX` have been exposed in headers.

True. Is there many external users of this API? I could not find any relevant examples using searchcode.com.
msg387957 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2021-03-02 19:44
I have no opinion about *adding* a struct, but we shouldn't remove the existing array of pointers, or this will needlessly break compatibility for existing users of the C API.
msg388075 - (view) Author: Hai Shi (shihai1991) * (Python triager) Date: 2021-03-04 05:05
> True. Is there many external users of this API? I could not find any relevant examples using searchcode.com.

Hm, many teams don't open their code, so we get check all user cases by searchcode web. So I have no any better sugesstion about it :(
msg388234 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2021-03-07 11:34
Just a note that #43422 would make this moot.
msg389253 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2021-03-21 17:47
Closing, as the C API was removed in GH-24960.
History
Date User Action Args
2022-04-11 14:59:40adminsetgithub: 87226
2021-03-21 17:47:15erlendaaslandsetstatus: open -> closed
resolution: out of date
messages: + msg389253

stage: resolved
2021-03-07 11:34:31mark.dickinsonsetnosy: + mark.dickinson
messages: + msg388234
2021-03-04 05:05:16shihai1991setmessages: + msg388075
2021-03-02 19:44:03pitrousetnosy: + pitrou
messages: + msg387957
2021-03-02 19:20:01erlendaaslandsetmessages: + msg387955
2021-03-02 16:51:53shihai1991setmessages: + msg387938
2021-02-27 21:21:49rhettingersetnosy: + rhettinger
messages: + msg387788
2021-02-26 13:06:03mark.dickinsonsetnosy: - mark.dickinson
2021-02-08 19:29:33erlendaaslandsetmessages: + msg386645
2021-02-08 17:37:08mark.dickinsonsetmessages: + msg386635
2021-01-29 19:15:14rhettingersetnosy: - rhettinger
2021-01-29 13:02:01serhiy.storchakasetnosy: + rhettinger, facundobatista, mark.dickinson, skrah
2021-01-29 09:47:12erlendaaslandsettype: enhancement
2021-01-29 09:46:53erlendaaslandcreate