From 12934f9a5f359eb1c3ca6774e0dd10cee976b9a2 Mon Sep 17 00:00:00 2001 From: dbXD320 Date: Fri, 5 Sep 2025 22:37:29 +0530 Subject: [PATCH] gh-138191: Document ``frame.f_generator`` in the data model (GH-138540) (cherry picked from commit e5c58300794a9f3054a0af3f76cf14b81a4da47f) Co-authored-by: dbXD320 Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- Doc/reference/datamodel.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 6915f24dc1d08f..1ce2a0f8d3c1f5 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1638,6 +1638,7 @@ and are also passed to registered trace functions. single: f_locals (frame attribute) single: f_lasti (frame attribute) single: f_builtins (frame attribute) + single: f_generator (frame attribute) Special read-only attributes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1675,6 +1676,12 @@ Special read-only attributes (this is an index into the :term:`bytecode` string of the :ref:`code object `) + * - .. attribute:: frame.f_generator + - The :term:`generator` or :term:`coroutine` object that owns this frame, + or ``None`` if the frame is a normal function. + + .. versionadded:: 3.14 + .. index:: single: f_trace (frame attribute) single: f_trace_lines (frame attribute)