summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorMarcel Plch <gmarcel.plch@gmail.com>2018-03-17 05:41:20 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2018-03-17 05:41:20 (GMT)
commitc2b0b12d1a137ada1023ab7c10b8d9a0249d95f9 (patch)
tree53b82a27d468a5fc63067d3d1ecbd186388666f9 /Doc
parentd6e140466142018ddbb7541185348be2b833a2ce (diff)
downloadcpython-c2b0b12d1a137ada1023ab7c10b8d9a0249d95f9.zip
cpython-c2b0b12d1a137ada1023ab7c10b8d9a0249d95f9.tar.gz
cpython-c2b0b12d1a137ada1023ab7c10b8d9a0249d95f9.tar.bz2
bpo-32374: m_traverse may be called with m_state=NULL (GH-5140)
Multi-phase initialized modules allow m_traverse to be called while the module is still being initialized, so module authors may need to account for that.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/c-api/module.rst12
1 files changed, 9 insertions, 3 deletions
diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst
index 7efab28..017b656 100644
--- a/Doc/c-api/module.rst
+++ b/Doc/c-api/module.rst
@@ -196,17 +196,23 @@ or request "multi-phase initialization" by returning the definition struct itsel
.. c:member:: traverseproc m_traverse
A traversal function to call during GC traversal of the module object, or
- *NULL* if not needed.
+ *NULL* if not needed. This function may be called before module state
+ is allocated (:c:func:`PyModule_GetState()` may return `NULL`),
+ and before the :c:member:`Py_mod_exec` function is executed.
.. c:member:: inquiry m_clear
A clear function to call during GC clearing of the module object, or
- *NULL* if not needed.
+ *NULL* if not needed. This function may be called before module state
+ is allocated (:c:func:`PyModule_GetState()` may return `NULL`),
+ and before the :c:member:`Py_mod_exec` function is executed.
.. c:member:: freefunc m_free
A function to call during deallocation of the module object, or *NULL* if
- not needed.
+ not needed. This function may be called before module state
+ is allocated (:c:func:`PyModule_GetState()` may return `NULL`),
+ and before the :c:member:`Py_mod_exec` function is executed.
Single-phase initialization
...........................