summaryrefslogtreecommitdiffstats
path: root/Doc/c-api/module.rst
diff options
context:
space:
mode:
authorPetr Viktorin <encukou@gmail.com>2021-08-04 18:01:31 (GMT)
committerGitHub <noreply@github.com>2021-08-04 18:01:31 (GMT)
commit10faada709561663d6b1f623d308ff45e3808cca (patch)
tree57861ee793de7ee91d21cbb018b13614e6ecdc5b /Doc/c-api/module.rst
parent3d2b4c6f18d7e644e5850d2af74ac5dc530eb24c (diff)
downloadcpython-10faada709561663d6b1f623d308ff45e3808cca.zip
cpython-10faada709561663d6b1f623d308ff45e3808cca.tar.gz
cpython-10faada709561663d6b1f623d308ff45e3808cca.tar.bz2
Note that tp_clear and m_clear are not always called (GH-27581)
Diffstat (limited to 'Doc/c-api/module.rst')
-rw-r--r--Doc/c-api/module.rst6
1 files changed, 6 insertions, 0 deletions
diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst
index a2541af..94c8d9f 100644
--- a/Doc/c-api/module.rst
+++ b/Doc/c-api/module.rst
@@ -221,6 +221,12 @@ or request "multi-phase initialization" by returning the definition struct itsel
than 0 and the module state (as returned by :c:func:`PyModule_GetState`)
is ``NULL``.
+ Like :c:member:`PyTypeObject.tp_clear`, this function is not *always*
+ called before a module is deallocated. For example, when reference
+ counting is enough to determine that an object is no longer used,
+ the cyclic garbage collector is not involved and
+ :c:member:`~PyModuleDef.m_free` is called directly.
+
.. versionchanged:: 3.9
No longer called before the module state is allocated.