Skip to content

[RFC] module state for PyModule or builtin module #4054

Open

Description

@youknowone

Summary

related CPython function: PyModule_GetState
We are handling them with sometimes module attr and the other times static variable.

Detailed Explanation

Drawbacks, Rationale, and Alternatives

Unresolved Questions

Activity

  1. bongjunj commented on Nov 3, 2022

    @bongjunj
    Contributor

    Related CPython implementations:

    https://github.com/python/cpython/blob/32f0c8271706550096c454eb512450b85fbfc320/Include/internal/pycore_moduleobject.h#L11-L29

    https://github.com/python/cpython/blob/5fd8c574e016aec85725ddc5ced8742267b0e1b3/Modules/_sha3/sha3module.c#L42-L57


    In C, module state are declared at each module as below:

    typedef struct {
      PyObject * some_state;
    } _module_state;

    And, a pointer to a module state is typically void *.

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

Metadata

Metadata

Labels

RFCRequest for comments

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions