Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Doc/deprecations/pending-removal-in-3.17.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ Pending removal in Python 3.17
but it has been retained for backward compatibility, with removal scheduled for Python
3.17. Users should use documented introspection helpers like :func:`typing.get_origin`
and :func:`typing.get_args` instead of relying on private implementation details.

* CLI:

- The :option:`-R` option. This option is does not have an effect
in most cases as hash randomization is enabled by default since Python 3.3.
See :gh:`137897` and :meth:`~object.__hash__` for more information.
13 changes: 3 additions & 10 deletions Doc/using/cmdline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -372,16 +372,7 @@ Miscellaneous options
:envvar:`PYTHONHASHSEED` environment variable is set to ``0``, 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
are "salted" with an unpredictable random value. Although they remain
constant within an individual Python process, they are not predictable
between repeated invocations of Python.

Hash randomization is intended to provide protection against a
denial-of-service caused by carefully chosen inputs that exploit the worst
case performance of a dict construction, *O*\ (*n*\ :sup:`2`) complexity. See
http://ocert.org/advisories/ocert-2011-003.html for details.
See :meth:`~object.__hash__` for more information about hash randomization.

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

.. deprecated-removed:: next 3.17


.. option:: -s

Expand Down
10 changes: 10 additions & 0 deletions Doc/whatsnew/3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,16 @@ module_name
Deprecated
==========

CLI
---

* The :option:`-R` option. This option is does not have an effect
in most cases as hash randomization is enabled by default since Python 3.3.
See :meth:`~object.__hash__` for more information about hash randomization.

(Contributed by Stan Ulbrych in :gh:`137897`)


hashlib
-------

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Deprecate the :option:`-R` command line option, and schedule for removal in
3.17
3 changes: 3 additions & 0 deletions Python/initconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -3019,6 +3019,9 @@ config_parse_cmdline(PyConfig *config, PyWideStringList *warnoptions,
break;

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

Expand Down
Loading