Skip to content

Commit efbc0f9

Browse files
Commit
1 parent 0c8fecc commit efbc0f9

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

Doc/deprecations/pending-removal-in-3.17.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@ Pending removal in Python 3.17
88
but it has been retained for backward compatibility, with removal scheduled for Python
99
3.17. Users should use documented introspection helpers like :func:`typing.get_origin`
1010
and :func:`typing.get_args` instead of relying on private implementation details.
11+
12+
* CLI:
13+
14+
- The :option:`-R` option. This option is does not have an effect
15+
in most cases as hash randomization is enabled by default since Python 3.3.
16+
See :gh:`137897` and :meth:`~object.__hash__` for more information.

Doc/using/cmdline.rst

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -372,16 +372,7 @@ Miscellaneous options
372372
:envvar:`PYTHONHASHSEED` environment variable is set to ``0``, since hash
373373
randomization is enabled by default.
374374

375-
On previous versions of Python, this option turns on hash randomization,
376-
so that the :meth:`~object.__hash__` values of str and bytes objects
377-
are "salted" with an unpredictable random value. Although they remain
378-
constant within an individual Python process, they are not predictable
379-
between repeated invocations of Python.
380-
381-
Hash randomization is intended to provide protection against a
382-
denial-of-service caused by carefully chosen inputs that exploit the worst
383-
case performance of a dict construction, *O*\ (*n*\ :sup:`2`) complexity. See
384-
http://ocert.org/advisories/ocert-2011-003.html for details.
375+
See :meth:`~object.__hash__` for more information about hash randomization.
385376

386377
:envvar:`PYTHONHASHSEED` allows you to set a fixed value for the hash
387378
seed secret.
@@ -391,6 +382,8 @@ Miscellaneous options
391382
.. versionchanged:: 3.7
392383
The option is no longer ignored.
393384

385+
.. deprecated-removed:: next 3.17
386+
394387

395388
.. option:: -s
396389

Doc/whatsnew/3.15.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,16 @@ module_name
417417
Deprecated
418418
==========
419419

420+
CLI
421+
___
422+
423+
* The :option:`-R` option. This option is does not have an effect
424+
in most cases as hash randomization is enabled by default since Python 3.3.
425+
See :meth:`~object.__hash__` for more information about hash randomization.
426+
427+
(Contributed by Stan Ulbrych in :gh:`137897`)
428+
429+
420430
hashlib
421431
-------
422432

Python/initconfig.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3019,6 +3019,9 @@ config_parse_cmdline(PyConfig *config, PyWideStringList *warnoptions,
30193019
break;
30203020

30213021
case 'R':
3022+
fprintf(stderr,
3023+
"The -R option is deprecated since Python 3.15 and "
3024+
"will be removed in Python 3.17\n");
30223025
config->use_hash_seed = 0;
30233026
break;
30243027

0 commit comments

Comments
 (0)