Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 773ca09

Browse files
[3.13] Document that PyType_GetModuleByDef returns a borrowed reference (GH-135666) (GH-135702)
(cherry picked from commit 140731f) Co-authored-by: Petr Viktorin <[email protected]>
1 parent 7e783e5 commit 773ca09

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Doc/c-api/type.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,10 @@ Type Objects
267267
and other places where a method's defining class cannot be passed using the
268268
:c:type:`PyCMethod` calling convention.
269269
270+
The returned reference is :term:`borrowed <borrowed reference>` from *type*,
271+
and will be valid as long as you hold a reference to *type*.
272+
Do not release it with :c:func:`Py_DECREF` or similar.
273+
270274
.. versionadded:: 3.11
271275
272276
.. c:function:: int PyUnstable_Type_AssignVersionTag(PyTypeObject *type)

Doc/data/refcounts.dat

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2371,6 +2371,10 @@ PyType_GetFlags:PyTypeObject*:type:0:
23712371
PyType_GetName:PyObject*::+1:
23722372
PyType_GetName:PyTypeObject*:type:0:
23732373

2374+
PyType_GetModuleByDef:PyObject*::0:
2375+
PyType_GetModuleByDef:PyTypeObject*:type:0:
2376+
PyType_GetModuleByDef:PyModuleDef*:def::
2377+
23742378
PyType_GetQualName:PyObject*::+1:
23752379
PyType_GetQualName:PyTypeObject*:type:0:
23762380

0 commit comments

Comments
 (0)