Commit 037e912
A datetime object d is aware if d.tzinfo is not None and
d.tzinfo.utcoffset(d) does not return None. If d.tzinfo is None,
or if d.tzinfo is not None but d.tzinfo.utcoffset(d) returns None,
d is naive.
This commit ensures that instances with non-None d.tzinfo, but
d.tzinfo.utcoffset(d) returning None are treated as naive.
In addition, C acceleration code will raise TypeError if
d.tzinfo.utcoffset(d) returns an object with the type other than
timedelta.
* Updated the documentation.
Assume that the term "naive" is defined elsewhere and remove the
not entirely correct clarification. Thanks, Tim.
(cherry picked from commit 877b232)
Co-authored-by: Alexander Belopolsky <[email protected]>
1 parent 298eb07 commit 037e912
File tree
5 files changed
+36
-14
lines changed- Doc/library
- Lib
- test
- Misc/NEWS.d/next/Library
- Modules
5 files changed
+36
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1058 | 1058 | | |
1059 | 1059 | | |
1060 | 1060 | | |
1061 | | - | |
1062 | | - | |
| 1061 | + | |
1063 | 1062 | | |
1064 | 1063 | | |
1065 | 1064 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1780 | 1780 | | |
1781 | 1781 | | |
1782 | 1782 | | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
1783 | 1789 | | |
1784 | 1790 | | |
1785 | 1791 | | |
1786 | 1792 | | |
1787 | 1793 | | |
1788 | | - | |
1789 | | - | |
1790 | | - | |
1791 | 1794 | | |
1792 | 1795 | | |
1793 | 1796 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2414 | 2414 | | |
2415 | 2415 | | |
2416 | 2416 | | |
| 2417 | + | |
2417 | 2418 | | |
2418 | | - | |
2419 | | - | |
2420 | | - | |
2421 | 2419 | | |
2422 | | - | |
2423 | | - | |
| 2420 | + | |
| 2421 | + | |
| 2422 | + | |
2424 | 2423 | | |
2425 | 2424 | | |
2426 | | - | |
2427 | | - | |
| 2425 | + | |
| 2426 | + | |
| 2427 | + | |
2428 | 2428 | | |
2429 | 2429 | | |
2430 | 2430 | | |
2431 | 2431 | | |
2432 | 2432 | | |
2433 | 2433 | | |
2434 | | - | |
2435 | | - | |
| 2434 | + | |
2436 | 2435 | | |
2437 | 2436 | | |
2438 | 2437 | | |
2439 | 2438 | | |
2440 | 2439 | | |
2441 | 2440 | | |
2442 | 2441 | | |
| 2442 | + | |
| 2443 | + | |
| 2444 | + | |
| 2445 | + | |
| 2446 | + | |
| 2447 | + | |
| 2448 | + | |
| 2449 | + | |
2443 | 2450 | | |
2444 | 2451 | | |
2445 | 2452 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5576 | 5576 | | |
5577 | 5577 | | |
5578 | 5578 | | |
| 5579 | + | |
5579 | 5580 | | |
5580 | 5581 | | |
5581 | 5582 | | |
| |||
5596 | 5597 | | |
5597 | 5598 | | |
5598 | 5599 | | |
| 5600 | + | |
| 5601 | + | |
| 5602 | + | |
| 5603 | + | |
| 5604 | + | |
| 5605 | + | |
| 5606 | + | |
| 5607 | + | |
| 5608 | + | |
| 5609 | + | |
5599 | 5610 | | |
5600 | 5611 | | |
5601 | 5612 | | |
| |||
0 commit comments