[Python-checkins] [3.10] bpo-43475: Add what's new entry for NaN hash changes (GH-26725) (GH-26743)

mdickinson webhook-mailer at python.org
Tue Jun 15 15:13:18 EDT 2021


https://github.com/python/cpython/commit/8d0b2ca493e236fcad8709a622c1ac8ad29c372d
commit: 8d0b2ca493e236fcad8709a622c1ac8ad29c372d
branch: 3.10
author: Mark Dickinson <mdickinson at enthought.com>
committer: mdickinson <dickinsm at gmail.com>
date: 2021-06-15T20:13:10+01:00
summary:

[3.10] bpo-43475: Add what's new entry for NaN hash changes (GH-26725) (GH-26743)

(cherry picked from commit 1d10bf0bb9409a406c56b0de8870df998637fd0f)

Co-authored-by: Mark Dickinson <mdickinson at enthought.com>

files:
M Doc/whatsnew/3.10.rst

diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst
index 530ffce59b15b..6bd4157164f5b 100644
--- a/Doc/whatsnew/3.10.rst
+++ b/Doc/whatsnew/3.10.rst
@@ -836,6 +836,13 @@ Other Language Changes
   effectless under ``from __future__ import annotations``.
   (Contributed by Batuhan Taskaya in :issue:`42725`.)
 
+* Hashes of NaN values of both :class:`float` type and
+  :class:`decimal.Decimal` type now depend on object identity. Formerly, they
+  always hashed to ``0`` even though NaN values are not equal to one another.
+  This caused potentially quadratic runtime behavior due to excessive hash
+  collisions when creating dictionaries and sets containing multiple NaNs.
+  (Contributed by Raymond Hettinger in :issue:`43475`.)
+
 New Modules
 ===========
 



More information about the Python-checkins mailing list