Commit 4f7a900
committed
gh-151770: Fix datetime.fromisoformat() assertion on an out-of-range month with a 24:00 time
The 24:00 midnight-rollover path validated only the upper month bound
before calling days_in_month(), so a month below 1 reached
assert(month >= 1) on a debug build (and AssertionError in the pure
Python implementation). Add the missing lower bound to both so an
out-of-range month consistently raises ValueError.1 parent aa5b164 commit 4f7a900
4 files changed
Lines changed: 6 additions & 2 deletions
File tree
- Lib
- test
- Misc/NEWS.d/next/Library
- Modules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1987 | 1987 | | |
1988 | 1988 | | |
1989 | 1989 | | |
1990 | | - | |
| 1990 | + | |
1991 | 1991 | | |
1992 | 1992 | | |
1993 | 1993 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3773 | 3773 | | |
3774 | 3774 | | |
3775 | 3775 | | |
| 3776 | + | |
3776 | 3777 | | |
3777 | 3778 | | |
3778 | 3779 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6144 | 6144 | | |
6145 | 6145 | | |
6146 | 6146 | | |
6147 | | - | |
| 6147 | + | |
6148 | 6148 | | |
6149 | 6149 | | |
6150 | 6150 | | |
| |||
0 commit comments