Commit d2b66b9
committed
gh-152060: Fix datetime.fromisoformat() raising AssertionError in pure Python
_pydatetime._parse_isoformat_date() asserted the date portion length, leaking
a bare AssertionError out of datetime.fromisoformat() for some malformed
strings (e.g. '2020-2020'), and behaving differently under -O. The C
accelerator already raises ValueError. Replace the assert with an explicit
ValueError so both implementations agree on all builds.1 parent a46db4f commit d2b66b9
3 files changed
Lines changed: 7 additions & 1 deletion
File tree
- Lib
- test
- Misc/NEWS.d/next/Library
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
358 | 358 | | |
359 | 359 | | |
360 | 360 | | |
361 | | - | |
| 361 | + | |
| 362 | + | |
362 | 363 | | |
363 | 364 | | |
364 | 365 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3757 | 3757 | | |
3758 | 3758 | | |
3759 | 3759 | | |
| 3760 | + | |
| 3761 | + | |
3760 | 3762 | | |
3761 | 3763 | | |
3762 | 3764 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
0 commit comments