From 3a004aa858ffb995f938c78498f3d639511da7b0 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sun, 10 Aug 2025 13:25:17 +0200 Subject: [PATCH 1/6] Commit --- Doc/using/cmdline.rst | 2 +- Python/initconfig.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst index cad49e2deeb46f..6fd87343bf036e 100644 --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -369,7 +369,7 @@ Miscellaneous options .. option:: -R Turn on hash randomization. This option only has an effect if the - :envvar:`PYTHONHASHSEED` environment variable is set to ``0``, since hash + :envvar:`PYTHONHASHSEED` environment variable is set, since hash randomization is enabled by default. On previous versions of Python, this option turns on hash randomization, diff --git a/Python/initconfig.c b/Python/initconfig.c index cc0db19d416058..fd2cfe56510b2c 100644 --- a/Python/initconfig.c +++ b/Python/initconfig.c @@ -273,6 +273,8 @@ Options (and corresponding environment variables):\n\ -P : don't prepend a potentially unsafe path to sys.path; also\n\ PYTHONSAFEPATH\n\ -q : don't print version and copyright messages on interactive startup\n\ +-R : enable hash randomization; + this option overrides PYTHONHASHSEED to use the default behavior\n\ -s : don't add user site directory to sys.path; also PYTHONNOUSERSITE=x\n\ -S : don't imply 'import site' on initialization\n\ -u : force the stdout and stderr streams to be unbuffered;\n\ From 846af0a436a113555d4f608ff042b8f0ac0bd829 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sun, 10 Aug 2025 13:27:54 +0200 Subject: [PATCH 2/6] Fixup --- Python/initconfig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/initconfig.c b/Python/initconfig.c index fd2cfe56510b2c..c60892256e6943 100644 --- a/Python/initconfig.c +++ b/Python/initconfig.c @@ -273,7 +273,7 @@ Options (and corresponding environment variables):\n\ -P : don't prepend a potentially unsafe path to sys.path; also\n\ PYTHONSAFEPATH\n\ -q : don't print version and copyright messages on interactive startup\n\ --R : enable hash randomization; +-R : enable hash randomization;\n\ this option overrides PYTHONHASHSEED to use the default behavior\n\ -s : don't add user site directory to sys.path; also PYTHONNOUSERSITE=x\n\ -S : don't imply 'import site' on initialization\n\ From 16ec869d8e8483574dcb43c04394dab3b40e1f54 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sun, 10 Aug 2025 18:43:30 +0200 Subject: [PATCH 3/6] Revert change --- Python/initconfig.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/Python/initconfig.c b/Python/initconfig.c index c60892256e6943..cc0db19d416058 100644 --- a/Python/initconfig.c +++ b/Python/initconfig.c @@ -273,8 +273,6 @@ Options (and corresponding environment variables):\n\ -P : don't prepend a potentially unsafe path to sys.path; also\n\ PYTHONSAFEPATH\n\ -q : don't print version and copyright messages on interactive startup\n\ --R : enable hash randomization;\n\ - this option overrides PYTHONHASHSEED to use the default behavior\n\ -s : don't add user site directory to sys.path; also PYTHONNOUSERSITE=x\n\ -S : don't imply 'import site' on initialization\n\ -u : force the stdout and stderr streams to be unbuffered;\n\ From b42ba76fe9d36762e8186dc49cf0254115e2f871 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Mon, 18 Aug 2025 10:18:58 +0200 Subject: [PATCH 4/6] Reword --- Doc/using/cmdline.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst index 6fd87343bf036e..85e29d7a5ae988 100644 --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -369,8 +369,8 @@ Miscellaneous options .. option:: -R Turn on hash randomization. This option only has an effect if the - :envvar:`PYTHONHASHSEED` environment variable is set, since hash - randomization is enabled by default. + :envvar:`PYTHONHASHSEED` environment variable is set to a specific seed, + since hash randomization is enabled by default. On previous versions of Python, this option turns on hash randomization, so that the :meth:`~object.__hash__` values of str and bytes objects From 3b402a15cd92a952038daaca537d0dca57e2e5d6 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Date: Mon, 1 Sep 2025 17:39:23 +0100 Subject: [PATCH 5/6] Reword --- Doc/using/cmdline.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst index 85e29d7a5ae988..aea29163f3294e 100644 --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -369,7 +369,7 @@ Miscellaneous options .. option:: -R Turn on hash randomization. This option only has an effect if the - :envvar:`PYTHONHASHSEED` environment variable is set to a specific seed, + :envvar:`PYTHONHASHSEED` environment variable is set, since hash randomization is enabled by default. On previous versions of Python, this option turns on hash randomization, From 6a421f0f532dda0506e8dffc2c28fc4b2572794c Mon Sep 17 00:00:00 2001 From: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Date: Mon, 1 Sep 2025 17:40:45 +0100 Subject: [PATCH 6/6] Correct --- Doc/using/cmdline.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst index aea29163f3294e..448f2725e9a3db 100644 --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -369,8 +369,8 @@ Miscellaneous options .. option:: -R Turn on hash randomization. This option only has an effect if the - :envvar:`PYTHONHASHSEED` environment variable is set, - since hash randomization is enabled by default. + :envvar:`PYTHONHASHSEED` environment variable is set to anything other + than ``random``, since hash randomization is enabled by default. On previous versions of Python, this option turns on hash randomization, so that the :meth:`~object.__hash__` values of str and bytes objects