From 9ea77c038da0b5cb8cdb0939c03590e0cb95ea34 Mon Sep 17 00:00:00 2001 From: Tian Gao Date: Wed, 24 Jan 2024 15:46:53 -0800 Subject: [PATCH 1/3] Add docs for f_trace_opcodes behavior on 3.12 --- Doc/library/sys.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index 62783a417e7583..bda7752180b7bf 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -1641,6 +1641,11 @@ always available. ``'opcode'`` event type added; :attr:`~frame.f_trace_lines` and :attr:`~frame.f_trace_opcodes` attributes added to frames + .. versionchanged:: 3.12 + ``'opcode'`` event will only be emitted if :attr:`~frame.f_trace_opcodes` + of at least one frame has been set to :const:`True` before :func:`settrace` + is called. + .. function:: set_asyncgen_hooks([firstiter] [, finalizer]) Accepts two optional keyword arguments which are callables that accept an From a0fc1fca6b02516f0b2023c740c14cd87ad43aca Mon Sep 17 00:00:00 2001 From: Tian Gao Date: Sun, 4 Feb 2024 12:14:14 -0800 Subject: [PATCH 2/3] Add 3.13 explanation --- Doc/library/sys.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index bda7752180b7bf..5fe8e5e324250f 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -1644,7 +1644,8 @@ always available. .. versionchanged:: 3.12 ``'opcode'`` event will only be emitted if :attr:`~frame.f_trace_opcodes` of at least one frame has been set to :const:`True` before :func:`settrace` - is called. + is called. This behavior is changed back in 3.13 to be consistent with + previous versions. .. function:: set_asyncgen_hooks([firstiter] [, finalizer]) From e44cd8153f88da28e9cbb6882c0651e5ed4632b7 Mon Sep 17 00:00:00 2001 From: Tian Gao Date: Sun, 4 Feb 2024 12:55:10 -0800 Subject: [PATCH 3/3] Update Doc/library/sys.rst Co-authored-by: Alex Waygood --- Doc/library/sys.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index 5fe8e5e324250f..35bd17d3a2c1b1 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -1644,7 +1644,7 @@ always available. .. versionchanged:: 3.12 ``'opcode'`` event will only be emitted if :attr:`~frame.f_trace_opcodes` of at least one frame has been set to :const:`True` before :func:`settrace` - is called. This behavior is changed back in 3.13 to be consistent with + is called. This behavior will be changed back in 3.13 to be consistent with previous versions. .. function:: set_asyncgen_hooks([firstiter] [, finalizer])