From cd69f5b858b9636c5aea1766ccdb5cccca169828 Mon Sep 17 00:00:00 2001 From: Devansh Baghla Date: Fri, 5 Sep 2025 18:41:24 +0530 Subject: [PATCH 1/6] Docs: add f_generator attribute to datamodel page and update index --- Doc/reference/datamodel.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index da04cfde3bd587..faf2ee2b519d4a 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1633,6 +1633,7 @@ and are also passed to registered trace functions. .. index:: single: f_back (frame attribute) + single: f_generator (frame attribute) single: f_code (frame attribute) single: f_globals (frame attribute) single: f_locals (frame attribute) @@ -1648,6 +1649,10 @@ Special read-only attributes - Points to the previous stack frame (towards the caller), or ``None`` if this is the bottom stack frame + * - .. attribute:: frame.f_generator + - Returns the generator or coroutine object that owns this frame, + or ``None`` if the frame is of a regular function. + * - .. attribute:: frame.f_code - The :ref:`code object ` being executed in this frame. Accessing this attribute raises an :ref:`auditing event ` From c8c995603a953c6c1fd9aeeeb288eaa902e340f2 Mon Sep 17 00:00:00 2001 From: Devansh Baghla Date: Fri, 5 Sep 2025 18:58:02 +0530 Subject: [PATCH 2/6] Docs: move f_generator attribute to end of datamodel page --- Doc/reference/datamodel.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index faf2ee2b519d4a..386b2dd50fd462 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1633,12 +1633,12 @@ and are also passed to registered trace functions. .. index:: single: f_back (frame attribute) - single: f_generator (frame attribute) single: f_code (frame attribute) single: f_globals (frame attribute) single: f_locals (frame attribute) single: f_lasti (frame attribute) single: f_builtins (frame attribute) + single: f_generator (frame attribute) Special read-only attributes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1649,10 +1649,6 @@ Special read-only attributes - Points to the previous stack frame (towards the caller), or ``None`` if this is the bottom stack frame - * - .. attribute:: frame.f_generator - - Returns the generator or coroutine object that owns this frame, - or ``None`` if the frame is of a regular function. - * - .. attribute:: frame.f_code - The :ref:`code object ` being executed in this frame. Accessing this attribute raises an :ref:`auditing event ` @@ -1679,6 +1675,10 @@ Special read-only attributes - The "precise instruction" of the frame object (this is an index into the :term:`bytecode` string of the :ref:`code object `) + + * - .. attribute:: frame.f_generator + - Returns the generator or coroutine object that owns this frame, + or ``None`` if the frame is of a regular function. .. index:: single: f_trace (frame attribute) From 143a22df7dc06f0f6378c666706c71fe4dc3e3af Mon Sep 17 00:00:00 2001 From: dbXD320 Date: Fri, 5 Sep 2025 22:07:29 +0530 Subject: [PATCH 3/6] Update Doc/reference/datamodel.rst Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- Doc/reference/datamodel.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 386b2dd50fd462..d8c1174b9d25f7 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1677,8 +1677,8 @@ Special read-only attributes :ref:`code object `) * - .. attribute:: frame.f_generator - - Returns the generator or coroutine object that owns this frame, - or ``None`` if the frame is of a regular function. + - The :term:`generator` or :term:`coroutine` object that owns this frame, + or ``None`` if the frame is a normal function. .. index:: single: f_trace (frame attribute) From 5d8538561455a98738848cb13c12e109b742d3d0 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Fri, 5 Sep 2025 17:50:34 +0100 Subject: [PATCH 4/6] Update Doc/reference/datamodel.rst --- Doc/reference/datamodel.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index d8c1174b9d25f7..f21a607c05492e 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1680,6 +1680,8 @@ Special read-only attributes - 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) From fdad13acab907bad9481b70109afe9b8b7e99246 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Fri, 5 Sep 2025 18:00:59 +0100 Subject: [PATCH 5/6] whitespace --- Doc/reference/datamodel.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index f21a607c05492e..27308b4414f759 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1675,7 +1675,6 @@ Special read-only attributes - The "precise instruction" of the frame object (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. From 7e44b339fd0160fb57a470afb3ebead3dca187c6 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Fri, 5 Sep 2025 18:01:25 +0100 Subject: [PATCH 6/6] whitespace --- Doc/reference/datamodel.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 27308b4414f759..64778e5fba5304 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1675,6 +1675,7 @@ Special read-only attributes - The "precise instruction" of the frame object (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.