Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
556c2622
Commit
556c2622
authored
Aug 07, 2013
by
Eli Bendersky
Browse files
Options
Browse Files
Download
Plain Diff
Closing #18668: Properly document setting m_size in PyModuleDef
parents
14cf5152
62216bfa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
Doc/c-api/module.rst
Doc/c-api/module.rst
+10
-4
No files found.
Doc/c-api/module.rst
View file @
556c2622
...
@@ -189,16 +189,22 @@ These functions are usually used in the module initialization function.
...
@@ -189,16 +189,22 @@ These functions are usually used in the module initialization function.
.. c:member:: Py_ssize_t m_size
.. c:member:: Py_ssize_t m_size
If the module object needs additional memory, this should be set to the
Some modules allow re-initialization (calling their ``PyInit_*`` function
number of bytes to allocate; a pointer to the block of memory can be
more than once). These modules should keep their state in a per-module
retrieved with :c:func:`PyModule_GetState`. If no memory is needed, set
memory area that can be retrieved with :c:func:`PyModule_GetState`.
this to ``-1``.
This memory should be used, rather than static globals, to hold per-module
This memory should be used, rather than static globals, to hold per-module
state, since it is then safe for use in multiple sub-interpreters. It is
state, since it is then safe for use in multiple sub-interpreters. It is
freed when the module object is deallocated, after the :c:member:`m_free`
freed when the module object is deallocated, after the :c:member:`m_free`
function has been called, if present.
function has been called, if present.
Setting ``m_size`` to a positive value specifies the size of the additional
memory required by the module. Setting it to ``-1`` means that the module can
not be re-initialized because it has global state. Setting it to ``0`` is
forbidden.
See :PEP:`3121` for more details.
.. c:member:: PyMethodDef* m_methods
.. c:member:: PyMethodDef* m_methods
A pointer to a table of module-level functions, described by
A pointer to a table of module-level functions, described by
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment