Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 16be4a3

Browse filesBrowse files
[3.12] gh-116035: Document that both tzinfo and fold are ignored in comparisons if tzinfo is the same (GH-116187) (GH-116216)
This mostly restores information removed in c12240e (GH-114749). (cherry picked from commit 05b0490) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
1 parent 8dae3fa commit 16be4a3
Copy full SHA for 16be4a3

File tree

Expand file treeCollapse file tree

1 file changed

+8
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-2
lines changed

‎Doc/library/datetime.rst

Copy file name to clipboardExpand all lines: Doc/library/datetime.rst
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,6 +1193,9 @@ Supported operations:
11931193
that are not also :class:`!datetime` instances, even if they represent
11941194
the same date.
11951195

1196+
If both comparands are aware, and have the same :attr:`!tzinfo` attribute,
1197+
the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and
1198+
the base datetimes are compared.
11961199
If both comparands are aware and have different :attr:`~.datetime.tzinfo`
11971200
attributes, the comparison acts as comparands were first converted to UTC
11981201
datetimes except that the implementation never overflows.
@@ -1207,6 +1210,9 @@ Supported operations:
12071210
as well as a :class:`!datetime` object and a :class:`!date` object
12081211
that is not also a :class:`!datetime` instance, raises :exc:`TypeError`.
12091212

1213+
If both comparands are aware, and have the same :attr:`!tzinfo` attribute,
1214+
the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and
1215+
the base datetimes are compared.
12101216
If both comparands are aware and have different :attr:`~.datetime.tzinfo`
12111217
attributes, the comparison acts as comparands were first converted to UTC
12121218
datetimes except that the implementation never overflows.
@@ -1752,8 +1758,8 @@ Naive and aware :class:`!time` objects are never equal.
17521758
Order comparison between naive and aware :class:`!time` objects raises
17531759
:exc:`TypeError`.
17541760

1755-
If both comparands are aware, and have
1756-
the same :attr:`~.time.tzinfo` attribute, the common :attr:`!tzinfo` attribute is
1761+
If both comparands are aware, and have the same :attr:`~.time.tzinfo`
1762+
attribute, the :attr:`!tzinfo` and :attr:`!fold` attributes are
17571763
ignored and the base times are compared. If both comparands are aware and
17581764
have different :attr:`!tzinfo` attributes, the comparands are first adjusted by
17591765
subtracting their UTC offsets (obtained from ``self.utcoffset()``).

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.