https://github.com/python/cpython/commit/773ca09caa3be3e771ed241a8910ccd1581ba3e2 commit: 773ca09caa3be3e771ed241a8910ccd1581ba3e2 branch: 3.13 author: Miss Islington (bot) <[email protected]> committer: encukou <[email protected]> date: 2025-06-19T09:18:00+02:00 summary:
[3.13] Document that PyType_GetModuleByDef returns a borrowed reference (GH-135666) (GH-135702) (cherry picked from commit 140731ff671395fb7a869c2784429c14dc83fb27) Co-authored-by: Petr Viktorin <[email protected]> files: M Doc/c-api/type.rst M Doc/data/refcounts.dat diff --git a/Doc/c-api/type.rst b/Doc/c-api/type.rst index be87b689fa1c22..1b69d6d22326f8 100644 --- a/Doc/c-api/type.rst +++ b/Doc/c-api/type.rst @@ -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) diff --git a/Doc/data/refcounts.dat b/Doc/data/refcounts.dat index 042cae5f18ab1a..ae24ae5ba8121b 100644 --- a/Doc/data/refcounts.dat +++ b/Doc/data/refcounts.dat @@ -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: _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
