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

Add PyType_GetModuleByDef to the public & limited API #90771

Closed
encukou opened this issue Feb 2, 2022 · 4 comments
Closed

Add PyType_GetModuleByDef to the public & limited API #90771

encukou opened this issue Feb 2, 2022 · 4 comments
Labels
3.11 bug and security fixes topic-C-API

Comments

@encukou
Copy link
Member

encukou commented Feb 2, 2022

BPO 46613
Nosy @encukou, @shihai1991
PRs
  • bpo-46613: Add PyType_GetModuleByDef to the public & limited API #31081
  • 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 = None
    created_at = <Date 2022-02-02.16:55:22.816>
    labels = ['expert-C-API', '3.11']
    title = 'Add PyType_GetModuleByDef to the public & limited API'
    updated_at = <Date 2022-02-11.16:23:15.131>
    user = 'https://github.com/encukou'

    bugs.python.org fields:

    activity = <Date 2022-02-11.16:23:15.131>
    actor = 'petr.viktorin'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['C API']
    creation = <Date 2022-02-02.16:55:22.816>
    creator = 'petr.viktorin'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46613
    keywords = ['patch']
    message_count = 3.0
    messages = ['412378', '413082', '413083']
    nosy_count = 2.0
    nosy_names = ['petr.viktorin', 'shihai1991']
    pr_nums = ['31081']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue46613'
    versions = ['Python 3.11']

    @encukou
    Copy link
    Member Author

    encukou commented Feb 2, 2022

    _PyType_GetModuleByDef (added in bpo-42100)allows module state access
    from slot methods (like tp_init or nb_add),
    the main thing missing from PEP-573 (Module State Access from C
    Extension Methods).
    It's time to make it public.

    The function itself can be implemented using only limited API, though
    it's a bit tricky to do so correctly (and our implementation uses
    private speedups), so it's better if extension authors can use it as a
    pre-made building block.

    Discussed in: https://mail.python.org/archives/list/capi-sig@python.org/thread/WMSDNMQ7A6LE6X4MQW4QAQUKDDL7MJ72/
    Note that a bug was found in the CPython optimization recently: bpo-46433

    @encukou encukou added 3.11 bug and security fixes topic-C-API labels Feb 2, 2022
    @encukou
    Copy link
    Member Author

    encukou commented Feb 11, 2022

    New changeset 2049469 by Petr Viktorin in branch 'main':
    bpo-46613: Add PyType_GetModuleByDef to the public API (GH-31081)
    2049469

    @encukou
    Copy link
    Member Author

    encukou commented Feb 11, 2022

    It's in public API, adding it to limited is still pending.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    AA-Turner pushed a commit to AA-Turner/devguide that referenced this issue Sep 13, 2023
    …n#31081)
    
    * Make PyType_GetModuleByDef public (remove underscore)
    
    Co-authored-by: Victor Stinner <vstinner@python.org>
    
    GitHub-Issue-Link: python/cpython#90771
    erlend-aasland pushed a commit to python/devguide that referenced this issue Sep 26, 2023
    …n#31081)
    
    * Make PyType_GetModuleByDef public (remove underscore)
    
    Co-authored-by: Victor Stinner <vstinner@python.org>
    
    GitHub-Issue-Link: python/cpython#90771
    @vstinner
    Copy link
    Member

    It's in public API, adding it to limited is still pending.

    I created issue gh-116936 for that. I close this issue.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 bug and security fixes topic-C-API
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants