classification
Title: [WIP] Add a new experimental _Py_CAPI2 API
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.8
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: vstinner
Priority: normal Keywords: patch

Created on 2018-11-10 01:37 by vstinner, last changed 2018-11-22 16:27 by vstinner. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 10443 closed vstinner, 2018-11-10 01:39
Messages (3)
msg329583 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-11-10 01:37
Add a new experimental "_Py_CAPI2" API: opt-in which doesn't leak implementation details and replace macros with function calls.

Attached PR modified PyTuple_GET_ITEM() if _Py_CAPI2 is defined.

With this API, PyTuple_GET_ITEM() macro becomes a function call and
the implementation uses assertions to check if the first argument is
a tuple and that the index is valid. It should help to investigate
bugs when Python is compiled in debug mode.

This issue implements the idea that I proposed on python-dev:
https://mail.python.org/pipermail/python-dev/2018-November/155702.html
msg329584 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-11-10 01:42
I previously tried a very similar patch but reusing Py_DEBUG define, rather than adding a new _Py_CAPI2 define: bpo-35199. I abandonned it because it was backward incompatible. This change is backward compatible: the new API is not compatible with the current API, but the change doesn't impact the default API which remains unchanged.
msg330268 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-11-22 16:27
According to discussions on python-dev, a PEP will be needed first. Moreover, I prefer to make some progress on https://bugs.python.org/issue35134 before. I close the issue.
History
Date User Action Args
2018-11-22 16:27:53vstinnersetstatus: open -> closed
resolution: rejected
messages: + msg330268

stage: patch review -> resolved
2018-11-10 02:17:21vstinnersettitle: Add a new experimental _Py_CAPI2 API -> [WIP] Add a new experimental _Py_CAPI2 API
2018-11-10 01:43:03vstinnersettitle: Add new experimental _Py_CAPI2 API -> Add a new experimental _Py_CAPI2 API
2018-11-10 01:42:29vstinnersetmessages: + msg329584
2018-11-10 01:39:32vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request9717
2018-11-10 01:37:33vstinnercreate