From b442ecae91f2365e1c4110bf060b38cd3dc2888c Mon Sep 17 00:00:00 2001 From: Matt Page Date: Mon, 23 Jun 2025 16:09:25 -0700 Subject: [PATCH 1/2] Document the X option and env var for controlling thread-local bytecode Add documentation for `-X tlbc` and `PYTHON_TLBC`. --- Doc/using/cmdline.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst index 40a46a62031ef7..1bd13c77b470b9 100644 --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -669,6 +669,13 @@ Miscellaneous options .. versionadded:: 3.14 + * :samp:`-X tlbc={0,1}` enables (1, the default) or disables (0) thread-local + bytecode in builds configured with :option:`--disable-gil`. When disabled, + this also disables specialization in the tier 1 interpreter. See also + :envvar:`PYTHON_TLBC`. + + .. versionadded:: 3.14 + It also allows passing arbitrary values and retrieving them through the :data:`sys._xoptions` dictionary. @@ -1302,6 +1309,16 @@ conflict. .. versionadded:: 3.13 +.. envvar:: PYTHON_TLBC + + If set to ``1`` enables thread-local bytecode. If set to ``0`` thread-local + bytecode (and specialization in the tier 1 interpreter) is disabled. Only + applies to builds configured with :option:`--disable-gil`. + + See also the :option:`-X tlbc <-X>` command-line option + + .. versionadded:: 3.14 + Debug-mode variables ~~~~~~~~~~~~~~~~~~~~ From a99539bf5b85f07f20803a9ebf98ca1a2015001a Mon Sep 17 00:00:00 2001 From: Matt Page Date: Tue, 24 Jun 2025 09:19:39 -0700 Subject: [PATCH 2/2] Replace references to "tier 1" with "specializing interpreter" --- Doc/using/cmdline.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst index 1bd13c77b470b9..a5867b489e0053 100644 --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -671,7 +671,7 @@ Miscellaneous options * :samp:`-X tlbc={0,1}` enables (1, the default) or disables (0) thread-local bytecode in builds configured with :option:`--disable-gil`. When disabled, - this also disables specialization in the tier 1 interpreter. See also + this also disables the specializing interpreter. See also :envvar:`PYTHON_TLBC`. .. versionadded:: 3.14 @@ -1312,10 +1312,10 @@ conflict. .. envvar:: PYTHON_TLBC If set to ``1`` enables thread-local bytecode. If set to ``0`` thread-local - bytecode (and specialization in the tier 1 interpreter) is disabled. Only - applies to builds configured with :option:`--disable-gil`. + bytecode and the specializing interpreter are disabled. Only applies to + builds configured with :option:`--disable-gil`. - See also the :option:`-X tlbc <-X>` command-line option + See also the :option:`-X tlbc <-X>` command-line option. .. versionadded:: 3.14