Skip to content

Update extending/embedding docs to new way to build modules in C #70702

Duplicate of#134160
@brettcannon

Description

@brettcannon
BPO 26515
Nosy @brettcannon, @ncoghlan, @encukou, @ericsnowcurrently, @berkerpeksag
PRs
  • bpo-26515: Update C API docs to use PyModuleDef_Init() #8682
  • 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 2016-03-09.02:43:41.063>
    labels = ['type-feature', '3.9', 'docs']
    title = 'Update extending/embedding docs to new way to build modules in C'
    updated_at = <Date 2020-12-15.15:36:08.559>
    user = 'https://github.com/brettcannon'

    bugs.python.org fields:

    activity = <Date 2020-12-15.15:36:08.559>
    actor = 'petr.viktorin'
    assignee = 'docs@python'
    closed = False
    closed_date = None
    closer = None
    components = ['Documentation']
    creation = <Date 2016-03-09.02:43:41.063>
    creator = 'brett.cannon'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 26515
    keywords = ['patch']
    message_count = 5.0
    messages = ['261398', '342668', '359792', '379432', '383069']
    nosy_count = 6.0
    nosy_names = ['brett.cannon', 'ncoghlan', 'petr.viktorin', 'docs@python', 'eric.snow', 'berker.peksag']
    pr_nums = ['8682']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue26515'
    versions = ['Python 3.9']

    Activity

    brettcannon

    brettcannon commented on Mar 9, 2016

    @brettcannon
    MemberAuthor

    https://docs.python.org/3/extending/extending.html#a-simple-example uses PyModule_Create() instead of PyModuleDef_Init().

    encukou

    encukou commented on May 16, 2019

    @encukou
    Member

    Correct usage of multi-phase init might now get users stuck when they start needing per-module state. See PEP-573 "Module State Access from C Extension Methods" for the (hopefully) last thing that prevents me from generally recommending multi-phase init.

    That PEP is on my list for after PRP 590 is done.
    Before it's implemented, I'm happy leaving PyModuleDef_Init to experts -- that is, have it in the reference docs only.

    ncoghlan

    ncoghlan commented on Jan 11, 2020

    @ncoghlan
    Contributor

    Changed target version as per Petr's comment (PEP-573 is close to being accepted for 3.9 - it just needs some editing to improve clarity in the PEP itself, rather than needing any changes to the technical proposal)

    added
    3.9only security fixes
    and removed on Jan 11, 2020
    encukou

    encukou commented on Oct 23, 2020

    @encukou
    Member

    There is now PEP-630. Still not done enough to move it out of draft status, but usable for converting simple modules.

    encukou

    encukou commented on Dec 15, 2020

    @encukou
    Member

    PEP-630 is now Active. I believe the vast majority of modules can now be ported, and it should be helpful for early adopters (including CPython stdlib). But there are still Open Issues and the API not battle-tested on all the edge cases.

    The PEP is written to be easily integrated into official docs when the time comes.

    transferred this issue fromon Apr 10, 2022

    2 remaining items

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.9only security fixesdocsDocumentation in the Doc dirtype-featureA feature request or enhancement

      Projects

      No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        Update extending/embedding docs to new way to build modules in C · Issue #70702 · python/cpython

        Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

        Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant