]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Document that PyType_GetModuleByDef returns a borrowed reference (GH-135666)
authorPetr Viktorin <encukou@gmail.com>
Thu, 19 Jun 2025 07:00:41 +0000 (09:00 +0200)
committerGitHub <noreply@github.com>
Thu, 19 Jun 2025 07:00:41 +0000 (09:00 +0200)
Doc/c-api/type.rst
Doc/data/refcounts.dat

index 2176b8e492f3061d8a8c49bed0bbdf51cc9817e1..5bdbff4e0ad990d79d8a3e5a45db2e2c8cffd520 100644 (file)
@@ -282,6 +282,10 @@ Type Objects
    and other places where a method's defining class cannot be passed using the
    :c:type:`PyCMethod` calling convention.
 
+   The returned reference is :term:`borrowed <borrowed reference>` from *type*,
+   and will be valid as long as you hold a reference to *type*.
+   Do not release it with :c:func:`Py_DECREF` or similar.
+
    .. versionadded:: 3.11
 
 .. c:function:: int PyType_GetBaseByToken(PyTypeObject *type, void *token, PyTypeObject **result)
index f5f02f0a79c93dcb92415909fb01699d4bd213f8..99cc823c0c377279b1def01ce4a3da7911149b2d 100644 (file)
@@ -2385,6 +2385,10 @@ PyType_GetFlags:PyTypeObject*:type:0:
 PyType_GetName:PyObject*::+1:
 PyType_GetName:PyTypeObject*:type:0:
 
+PyType_GetModuleByDef:PyObject*::0:
+PyType_GetModuleByDef:PyTypeObject*:type:0:
+PyType_GetModuleByDef:PyModuleDef*:def::
+
 PyType_GetQualName:PyObject*::+1:
 PyType_GetQualName:PyTypeObject*:type:0: