diff options
author | Petr Viktorin <encukou@gmail.com> | 2022-02-11 16:22:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-11 16:22:11 (GMT) |
commit | 204946986feee7bc80b233350377d24d20fcb1b8 (patch) | |
tree | e66ab16090f97845e0f95f981c720954e244d102 /Doc/howto | |
parent | e0bcfd0e4db193743d4bafc48d10f15ae9ed7b2b (diff) | |
download | cpython-204946986feee7bc80b233350377d24d20fcb1b8.zip cpython-204946986feee7bc80b233350377d24d20fcb1b8.tar.gz cpython-204946986feee7bc80b233350377d24d20fcb1b8.tar.bz2 |
bpo-46613: Add PyType_GetModuleByDef to the public API (GH-31081)
* Make PyType_GetModuleByDef public (remove underscore)
Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Doc/howto')
-rw-r--r-- | Doc/howto/clinic.rst | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Doc/howto/clinic.rst b/Doc/howto/clinic.rst index a3c4330..04b1a2c 100644 --- a/Doc/howto/clinic.rst +++ b/Doc/howto/clinic.rst @@ -1249,15 +1249,15 @@ The ``defining_class`` converter is not compatible with ``__init__`` and ``__new methods, which cannot use the ``METH_METHOD`` convention. It is not possible to use ``defining_class`` with slot methods. In order to -fetch the module state from such methods, use ``_PyType_GetModuleByDef`` to -look up the module and then :c:func:`PyModule_GetState` to fetch the module +fetch the module state from such methods, use :c:func:`PyType_GetModuleByDef` +to look up the module and then :c:func:`PyModule_GetState` to fetch the module state. Example from the ``setattro`` slot method in ``Modules/_threadmodule.c``:: static int local_setattro(localobject *self, PyObject *name, PyObject *v) { - PyObject *module = _PyType_GetModuleByDef(Py_TYPE(self), &thread_module); + PyObject *module = PyType_GetModuleByDef(Py_TYPE(self), &thread_module); thread_module_state *state = get_thread_state(module); ... } |