Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add a new experimental _Py_CAPI2 API #79387

Closed
vstinner opened this issue Nov 10, 2018 · 3 comments
Closed

[WIP] Add a new experimental _Py_CAPI2 API #79387

vstinner opened this issue Nov 10, 2018 · 3 comments
Labels
3.8 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@vstinner
Copy link
Member

BPO 35206
Nosy @vstinner
PRs
  • [WIP] bpo-35206: Add new experimental _Py_CAPI2 API #10443
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2018-11-22.16:27:53.358>
    created_at = <Date 2018-11-10.01:37:33.708>
    labels = ['interpreter-core', '3.8']
    title = '[WIP] Add a new experimental _Py_CAPI2 API'
    updated_at = <Date 2018-11-22.16:27:53.356>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2018-11-22.16:27:53.356>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-11-22.16:27:53.358>
    closer = 'vstinner'
    components = ['Interpreter Core']
    creation = <Date 2018-11-10.01:37:33.708>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 35206
    keywords = ['patch']
    message_count = 3.0
    messages = ['329583', '329584', '330268']
    nosy_count = 1.0
    nosy_names = ['vstinner']
    pr_nums = ['10443']
    priority = 'normal'
    resolution = 'rejected'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue35206'
    versions = ['Python 3.8']

    @vstinner
    Copy link
    Member Author

    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

    @vstinner vstinner added 3.8 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Nov 10, 2018
    @vstinner
    Copy link
    Member Author

    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.

    @vstinner vstinner changed the title Add new experimental _Py_CAPI2 API Add a new experimental _Py_CAPI2 API Nov 10, 2018
    @vstinner vstinner changed the title Add a new experimental _Py_CAPI2 API [WIP] Add a new experimental _Py_CAPI2 API Nov 10, 2018
    @vstinner
    Copy link
    Member Author

    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.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.8 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs)
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant