From 03701c309d21272f44b3077199fe5842d858024f Mon Sep 17 00:00:00 2001 From: Rafael Weingartner-Ortner Date: Sat, 17 Jan 2026 10:28:44 +0100 Subject: [PATCH 1/6] Document ways to disable remote debugging support Although PEP 768 mentions how to disable the mechanism of remote debugging, it is not documented in the Python docs. This change adds a note on how to disable remote debugging support in a Python interpreter to the remote debugging how-to and to the sys.remote_exec docs. --- Doc/howto/remote_debugging.rst | 8 +++++++- Doc/library/sys.rst | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Doc/howto/remote_debugging.rst b/Doc/howto/remote_debugging.rst index 78b40bcdf7127b..f86000187da696 100644 --- a/Doc/howto/remote_debugging.rst +++ b/Doc/howto/remote_debugging.rst @@ -8,6 +8,13 @@ execute Python code remotely. Most platforms require elevated privileges to attach to another Python process. +.. note:: + + You can disable remote debugging support in a Python interpreter by (1) setting the + ``PYTHON_DISABLE_REMOTE_DEBUG`` environment variable to any value before starting + the interpreter, (2) using the ``-X disable-remote-debug`` command-line option, or + (3) compiling Python with the ``--without-remote-debug`` build flag. + .. _permission-requirements: Permission requirements @@ -614,4 +621,3 @@ To inject and execute a Python script in a remote process: 6. Set ``_PY_EVAL_PLEASE_STOP_BIT`` in the ``eval_breaker`` field. 7. Resume the process (if suspended). The script will execute at the next safe evaluation point. - diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index a0621d4b0dbd09..aa49a5238a7e91 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -1997,6 +1997,13 @@ always available. Unless explicitly noted otherwise, all variables are read-only interpreter is pre-release (alpha, beta, or release candidate) then the local and remote interpreters must be the same exact version. + .. note:: + + You can disable remote debugging support in a Python interpreter by (1) setting the + ``PYTHON_DISABLE_REMOTE_DEBUG`` environment variable to any value before starting + the interpreter, (2) using the ``-X disable-remote-debug`` command-line option, or + (3) compiling Python with the ``--without-remote-debug`` build flag. + .. audit-event:: sys.remote_exec pid script_path When the code is executed in the remote process, an From 6b6a501dc363916a151216c2d6f05f36e654c65b Mon Sep 17 00:00:00 2001 From: Rafael Weingartner-Ortner Date: Sun, 18 Jan 2026 11:15:31 +0100 Subject: [PATCH 2/6] Add internal links to env vars and cmd options --- Doc/howto/remote_debugging.rst | 7 ++++--- Doc/library/sys.rst | 9 +++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Doc/howto/remote_debugging.rst b/Doc/howto/remote_debugging.rst index f86000187da696..b48c6afada33d4 100644 --- a/Doc/howto/remote_debugging.rst +++ b/Doc/howto/remote_debugging.rst @@ -11,9 +11,10 @@ Most platforms require elevated privileges to attach to another Python process. .. note:: You can disable remote debugging support in a Python interpreter by (1) setting the - ``PYTHON_DISABLE_REMOTE_DEBUG`` environment variable to any value before starting - the interpreter, (2) using the ``-X disable-remote-debug`` command-line option, or - (3) compiling Python with the ``--without-remote-debug`` build flag. + :envvar:`PYTHON_DISABLE_REMOTE_DEBUG` environment variable to any value before + starting the interpreter, (2) using the :option:`-X disable_remote_debug` + command-line option, or (3) compiling Python with the :option:`--without-remote-debug` + build flag. .. _permission-requirements: diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index aa49a5238a7e91..d05abcbf62def1 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -1999,10 +1999,11 @@ always available. Unless explicitly noted otherwise, all variables are read-only .. note:: - You can disable remote debugging support in a Python interpreter by (1) setting the - ``PYTHON_DISABLE_REMOTE_DEBUG`` environment variable to any value before starting - the interpreter, (2) using the ``-X disable-remote-debug`` command-line option, or - (3) compiling Python with the ``--without-remote-debug`` build flag. + You can disable remote debugging support in a Python interpreter by (1) setting + the :envvar:`PYTHON_DISABLE_REMOTE_DEBUG` environment variable to any value before + starting the interpreter, (2) using the :option:`-X disable_remote_debug` + command-line option, or (3) compiling Python with the + :option:`--without-remote-debug` build flag. .. audit-event:: sys.remote_exec pid script_path From cdf5fa294c92272234e09fff6c2308fe17f498fd Mon Sep 17 00:00:00 2001 From: Rafael Weingartner-Ortner <38643099+RafaelWO@users.noreply.github.com> Date: Mon, 19 Jan 2026 10:04:53 +0100 Subject: [PATCH 3/6] Convert long sentence to bullet points (by @hugovk) In remote_rebugging.rst Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- Doc/howto/remote_debugging.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Doc/howto/remote_debugging.rst b/Doc/howto/remote_debugging.rst index b48c6afada33d4..a044a8246e0d13 100644 --- a/Doc/howto/remote_debugging.rst +++ b/Doc/howto/remote_debugging.rst @@ -10,11 +10,12 @@ Most platforms require elevated privileges to attach to another Python process. .. note:: - You can disable remote debugging support in a Python interpreter by (1) setting the - :envvar:`PYTHON_DISABLE_REMOTE_DEBUG` environment variable to any value before - starting the interpreter, (2) using the :option:`-X disable_remote_debug` - command-line option, or (3) compiling Python with the :option:`--without-remote-debug` - build flag. + To disable remote debugging support, use any of the following: + + * Set the :envvar:`PYTHON_DISABLE_REMOTE_DEBUG` environment variable to + any value before starting the interpreter. + * Use the :option:`-X disable_remote_debug` command-line option. + * Compile Python with the :option:`--without-remote-debug` build flag. .. _permission-requirements: From 4094fd9b6569b7cd92a64faeaea64a8aa5725eee Mon Sep 17 00:00:00 2001 From: Rafael Weingartner-Ortner <38643099+RafaelWO@users.noreply.github.com> Date: Mon, 19 Jan 2026 10:05:18 +0100 Subject: [PATCH 4/6] Convert long sentence to bullet points (by @hugovk) in sys.rst Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- Doc/library/sys.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index d05abcbf62def1..693556865ef2f8 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -1999,11 +1999,12 @@ always available. Unless explicitly noted otherwise, all variables are read-only .. note:: - You can disable remote debugging support in a Python interpreter by (1) setting - the :envvar:`PYTHON_DISABLE_REMOTE_DEBUG` environment variable to any value before - starting the interpreter, (2) using the :option:`-X disable_remote_debug` - command-line option, or (3) compiling Python with the - :option:`--without-remote-debug` build flag. + To disable remote debugging support, use any of the following: + + * Set the :envvar:`PYTHON_DISABLE_REMOTE_DEBUG` environment variable to + any value before starting the interpreter. + * Use the :option:`-X disable_remote_debug` command-line option. + * Compile Python with the :option:`--without-remote-debug` build flag. .. audit-event:: sys.remote_exec pid script_path From 52a4439e4939e744892d54eba89121d71b8f8a4b Mon Sep 17 00:00:00 2001 From: Rafael Weingartner-Ortner Date: Tue, 20 Jan 2026 21:13:39 +0100 Subject: [PATCH 5/6] Convert note to subsection --- Doc/howto/remote_debugging.rst | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Doc/howto/remote_debugging.rst b/Doc/howto/remote_debugging.rst index a044a8246e0d13..2d148a7295cfeb 100644 --- a/Doc/howto/remote_debugging.rst +++ b/Doc/howto/remote_debugging.rst @@ -8,14 +8,15 @@ execute Python code remotely. Most platforms require elevated privileges to attach to another Python process. -.. note:: +Disabling remote debugging +-------------------------- - To disable remote debugging support, use any of the following: +To disable remote debugging support, use any of the following: - * Set the :envvar:`PYTHON_DISABLE_REMOTE_DEBUG` environment variable to - any value before starting the interpreter. - * Use the :option:`-X disable_remote_debug` command-line option. - * Compile Python with the :option:`--without-remote-debug` build flag. +* Set the :envvar:`PYTHON_DISABLE_REMOTE_DEBUG` environment variable to + any value before starting the interpreter. +* Use the :option:`-X disable_remote_debug` command-line option. +* Compile Python with the :option:`--without-remote-debug` build flag. .. _permission-requirements: From 5d7a544cf029e9b5975a3715310fb8fe3e359091 Mon Sep 17 00:00:00 2001 From: Rafael Weingartner-Ortner Date: Tue, 20 Jan 2026 21:21:35 +0100 Subject: [PATCH 6/6] Suggest setting PYTHON_DISABLE_REMOTE_DEBUG to 1 --- Doc/howto/remote_debugging.rst | 4 ++-- Doc/library/sys.rst | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/howto/remote_debugging.rst b/Doc/howto/remote_debugging.rst index 2d148a7295cfeb..dfe0176b75a020 100644 --- a/Doc/howto/remote_debugging.rst +++ b/Doc/howto/remote_debugging.rst @@ -13,8 +13,8 @@ Disabling remote debugging To disable remote debugging support, use any of the following: -* Set the :envvar:`PYTHON_DISABLE_REMOTE_DEBUG` environment variable to - any value before starting the interpreter. +* Set the :envvar:`PYTHON_DISABLE_REMOTE_DEBUG` environment variable to ``1`` before + starting the interpreter. * Use the :option:`-X disable_remote_debug` command-line option. * Compile Python with the :option:`--without-remote-debug` build flag. diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index 693556865ef2f8..cc06288ad9419c 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -2001,8 +2001,8 @@ always available. Unless explicitly noted otherwise, all variables are read-only To disable remote debugging support, use any of the following: - * Set the :envvar:`PYTHON_DISABLE_REMOTE_DEBUG` environment variable to - any value before starting the interpreter. + * Set the :envvar:`PYTHON_DISABLE_REMOTE_DEBUG` environment variable to ``1`` + before starting the interpreter. * Use the :option:`-X disable_remote_debug` command-line option. * Compile Python with the :option:`--without-remote-debug` build flag.