]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-116035: Document that both tzinfo and fold are ignored in comparisons if...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 1 Mar 2024 17:26:49 +0000 (18:26 +0100)
committerGitHub <noreply@github.com>
Fri, 1 Mar 2024 17:26:49 +0000 (19:26 +0200)
This mostly restores information removed in c12240ed28aac6494750e00143bc550c4d6d8ad1 (GH-114749).
(cherry picked from commit 05b04903a14279421ecdc6522b8202822de6ebb5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Doc/library/datetime.rst

index 30ac1a9b109108e00b795e7b50b507d88ca7ad4f..6b42fcc8a7a6644217c7cee92b5c3abfb9750925 100644 (file)
@@ -1185,6 +1185,9 @@ Supported operations:
    that are not also :class:`!datetime` instances, even if they represent
    the same date.
 
+   If both comparands are aware, and have the same :attr:`!tzinfo` attribute,
+   the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and
+   the base datetimes are compared.
    If both comparands are aware and have different :attr:`~.datetime.tzinfo`
    attributes, the comparison acts as comparands were first converted to UTC
    datetimes except that the implementation never overflows.
@@ -1199,6 +1202,9 @@ Supported operations:
    as well as a :class:`!datetime` object and a :class:`!date` object
    that is not also a :class:`!datetime` instance, raises :exc:`TypeError`.
 
+   If both comparands are aware, and have the same :attr:`!tzinfo` attribute,
+   the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and
+   the base datetimes are compared.
    If both comparands are aware and have different :attr:`~.datetime.tzinfo`
    attributes, the comparison acts as comparands were first converted to UTC
    datetimes except that the implementation never overflows.
@@ -1744,8 +1750,8 @@ Naive and aware :class:`!time` objects are never equal.
 Order comparison between naive and aware :class:`!time` objects raises
 :exc:`TypeError`.
 
-If both comparands are aware, and have
-the same :attr:`~.time.tzinfo` attribute, the common :attr:`!tzinfo` attribute is
+If both comparands are aware, and have the same :attr:`~.time.tzinfo`
+attribute, the :attr:`!tzinfo` and :attr:`!fold` attributes are
 ignored and the base times are compared. If both comparands are aware and
 have different :attr:`!tzinfo` attributes, the comparands are first adjusted by
 subtracting their UTC offsets (obtained from ``self.utcoffset()``).