File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -189,16 +189,22 @@ These functions are usually used in the module initialization function.
189189
190190 .. c :member :: Py_ssize_t m_size
191191
192- If the module object needs additional memory, this should be set to the
193- number of bytes to allocate; a pointer to the block of memory can be
194- retrieved with :c:func: `PyModule_GetState `. If no memory is needed, set
195- this to ``-1 ``.
192+ Some modules allow re-initialization (calling their ``PyInit_* `` function
193+ more than once). These modules should keep their state in a per-module
194+ memory area that can be retrieved with :c:func:`PyModule_GetState`.
196195
197196 This memory should be used, rather than static globals, to hold per-module
198197 state, since it is then safe for use in multiple sub-interpreters. It is
199198 freed when the module object is deallocated, after the :c:member:`m_free`
200199 function has been called, if present.
201200
201+ Setting ``m_size`` to a positive value specifies the size of the additional
202+ memory required by the module. Setting it to ``-1`` means that the module can
203+ not be re-initialized because it has global state. Setting it to ``0`` is
204+ forbidden.
205+
206+ See :PEP:`3121` for more details.
207+
202208 .. c:member:: PyMethodDef* m_methods
203209
204210 A pointer to a table of module-level functions, described by
You can’t perform that action at this time.
0 commit comments