]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] Document that PyType_GetModuleByDef returns a borrowed reference (GH-135666...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 19 Jun 2025 07:18:00 +0000 (09:18 +0200)
committerGitHub <noreply@github.com>
Thu, 19 Jun 2025 07:18:00 +0000 (09:18 +0200)
(cherry picked from commit 140731ff671395fb7a869c2784429c14dc83fb27)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Doc/c-api/type.rst
Doc/data/refcounts.dat

index be87b689fa1c22b3938c84b40cc43f2b79f9df03..1b69d6d22326f83624ac0ee77984e61e1a5a8195 100644 (file)
@@ -267,6 +267,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 PyUnstable_Type_AssignVersionTag(PyTypeObject *type)
index 042cae5f18ab1add41959a4409fe0ba27c9bac1c..ae24ae5ba8121be38487e37b261220332950368a 100644 (file)
@@ -2371,6 +2371,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: