summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorBénédikt Tran <10796600+picnixz@users.noreply.github.com>2024-09-23 23:44:36 (GMT)
committerGitHub <noreply@github.com>2024-09-23 23:44:36 (GMT)
commit38a887dc3ec52c4a7222279bf4b3ca2431b86de9 (patch)
tree54d37cb1aa9d648e9a6dbfb7330894b5c5fd66b1 /Doc
parente80dd3035fb805716bc49f9e7e9cab5f83614661 (diff)
downloadcpython-38a887dc3ec52c4a7222279bf4b3ca2431b86de9.zip
cpython-38a887dc3ec52c4a7222279bf4b3ca2431b86de9.tar.gz
cpython-38a887dc3ec52c4a7222279bf4b3ca2431b86de9.tar.bz2
gh-119004: fix a crash in equality testing between `OrderedDict` (#121329)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/collections.rst7
1 files changed, 5 insertions, 2 deletions
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
index ce89101..cee4e35 100644
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -1169,8 +1169,11 @@ Some differences from :class:`dict` still remain:
In addition to the usual mapping methods, ordered dictionaries also support
reverse iteration using :func:`reversed`.
+.. _collections_OrderedDict__eq__:
+
Equality tests between :class:`OrderedDict` objects are order-sensitive
-and are implemented as ``list(od1.items())==list(od2.items())``.
+and are roughly equivalent to ``list(od1.items())==list(od2.items())``.
+
Equality tests between :class:`OrderedDict` objects and other
:class:`~collections.abc.Mapping` objects are order-insensitive like regular
dictionaries. This allows :class:`OrderedDict` objects to be substituted
@@ -1186,7 +1189,7 @@ anywhere a regular dictionary is used.
method.
.. versionchanged:: 3.9
- Added merge (``|``) and update (``|=``) operators, specified in :pep:`584`.
+ Added merge (``|``) and update (``|=``) operators, specified in :pep:`584`.
:class:`OrderedDict` Examples and Recipes