@@ -606,12 +606,11 @@ Other constructors, all class methods:
606606
607607 .. note ::
608608
609- If *format * specifies a day of month without a year a
610- :exc: `DeprecationWarning ` is emitted . This is to avoid a quadrennial
609+ If *format * specifies a day of month (`` %d ``) without a year,
610+ :exc: `ValueError ` is raised . This is to avoid a quadrennial
611611 leap year bug in code seeking to parse only a month and day as the
612612 default year used in absence of one in the format is not a leap year.
613- Such *format * values may raise an error as of Python 3.15. The
614- workaround is to always include a year in your *format *. If parsing
613+ The workaround is to always include a year in your *format *. If parsing
615614 *date_string * values that do not have a year, explicitly add a year that
616615 is a leap year before parsing:
617616
@@ -1180,14 +1179,13 @@ Other constructors, all class methods:
11801179 time tuple. See also :ref: `strftime-strptime-behavior ` and
11811180 :meth: `datetime.fromisoformat `.
11821181
1183- .. versionchanged :: 3.13
1182+ .. versionchanged :: 3.15
11841183
1185- If *format * specifies a day of month without a year a
1186- :exc: `DeprecationWarning ` is now emitted . This is to avoid a quadrennial
1184+ If *format * specifies a day of month (`` %d ``) without a year,
1185+ :exc: `ValueError ` is raised . This is to avoid a quadrennial
11871186 leap year bug in code seeking to parse only a month and day as the
11881187 default year used in absence of one in the format is not a leap year.
1189- Such *format * values may raise an error as of Python 3.15. The
1190- workaround is to always include a year in your *format *. If parsing
1188+ The workaround is to always include a year in your *format *. If parsing
11911189 *date_string * values that do not have a year, explicitly add a year that
11921190 is a leap year before parsing:
11931191
@@ -2572,13 +2570,13 @@ requires, and these work on all supported platforms.
25722570| | truncated to an integer as a | | |
25732571| | zero-padded decimal number. | | |
25742572+-----------+--------------------------------+------------------------+-------+
2575- | ``%d `` | Day of the month as a | 01, 02, ..., 31 | \( 9) |
2576- | | zero-padded decimal number. | | |
2573+ | ``%d `` | Day of the month as a | 01, 02, ..., 31 | \( 9), |
2574+ | | zero-padded decimal number. | | \( 10) |
25772575+-----------+--------------------------------+------------------------+-------+
25782576| ``%D `` | Equivalent to ``%m/%d/%y ``. | 11/28/25 | \( 9) |
25792577| | | | |
25802578+-----------+--------------------------------+------------------------+-------+
2581- | ``%e `` | The day of the month as a | ␣1, ␣2, ..., 31 | |
2579+ | ``%e `` | The day of the month as a | ␣1, ␣2, ..., 31 | \( 10) |
25822580| | space-padded decimal number. | | |
25832581+-----------+--------------------------------+------------------------+-------+
25842582| ``%F `` | Equivalent to ``%Y-%m-%d ``, | 2025-10-11, | |
@@ -2919,11 +2917,12 @@ Notes:
29192917 >>> dt.datetime.strptime(f " { month_day} ;1984 " , " %m/%d ;%Y" ) # No leap year bug.
29202918 datetime.datetime(1984, 2, 29, 0, 0)
29212919
2922- .. deprecated-removed :: 3.13 3.15
2920+ .. versionchanged :: 3.15
2921+ Using ``%d `` without a year now raises :exc: `ValueError `.
2922+
2923+ .. deprecated-removed :: 3.15 3.17
29232924 :meth: `~.datetime.strptime ` calls using a format string containing
2924- a day of month without a year now emit a
2925- :exc: `DeprecationWarning `. In 3.15 or later we may change this into
2926- an error or change the default year to a leap year. See :gh: `70647 `.
2925+ ``%e `` without a year now emit a :exc: `DeprecationWarning `.
29272926
29282927.. rubric :: Footnotes
29292928
0 commit comments