8000 [RFC] module state for PyModule or builtin module · Issue #4054 · RustPython/RustPython · GitHub
[go: up one dir, main page]

Skip to content

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

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

Open
youknowone opened this issue Aug 13, 2022 · 1 comment
Open

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

youknowone opened this issue Aug 13, 2022 · 1 comment
Labels
RFC Request for comments

Comments

@youknowone
Copy link
Member

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

@youknowone youknowone added the RFC Request for comments label Aug 13, 2022
@bongjunj
Copy link
Contributor
bongjunj commented Nov 3, 2022

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
Labels
RFC Request for comments
Projects
None yet
Development

No branches or pull requests

2 participants
0