Skip to content

Commit dd067c1

Browse files
Change to Python 3.18
1 parent c079c2a commit dd067c1

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

Doc/deprecations/pending-removal-in-3.18.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Pending removal in Python 3.18
22
------------------------------
33

4+
* :mod:`datetime`:
5+
6+
* :meth:`~datetime.datetime.strptime` calls using a format string containing
7+
a day of month without a year. This has been deprecated since Python 3.13.
8+
49
* :mod:`decimal`:
510

611
* The non-standard and undocumented :class:`~decimal.Decimal` format

Doc/library/datetime.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,7 @@ Other constructors, all class methods:
11681168
:exc:`DeprecationWarning` is now emitted. This is to avoid a quadrennial
11691169
leap year bug in code seeking to parse only a month and day as the
11701170
default year used in absence of one in the format is not a leap year.
1171-
Such *format* values may raise an error as of Python 3.15. The
1171+
Such *format* values may raise an error as of Python 3.18. The
11721172
workaround is to always include a year in your *format*. If parsing
11731173
*date_string* values that do not have a year, explicitly add a year that
11741174
is a leap year before parsing:
@@ -2532,7 +2532,7 @@ requires, and these work on all supported platforms.
25322532
| | zero-padded decimal number. | | |
25332533
+-----------+--------------------------------+------------------------+-------+
25342534
| ``%d`` | Day of the month as a | 01, 02, ..., 31 | \(9), |
2535-
| | zero-padded decimal number. | | \(10 |
2535+
| | zero-padded decimal number. | | \(10) |
25362536
+-----------+--------------------------------+------------------------+-------+
25372537
| ``%D`` | Equivalent to ``%m/%d/%y``. | 11/10/2025 | \(9), |
25382538
| | | | \(0) |
@@ -2868,11 +2868,11 @@ Notes:
28682868
>>> datetime.strptime(f"{month_day};1984", "%m/%d;%Y") # No leap year bug.
28692869
datetime.datetime(1984, 2, 29, 0, 0)
28702870

2871-
.. deprecated-removed:: 3.13 3.15
2871+
.. deprecated-removed:: 3.13 3.18
28722872
:meth:`~.datetime.strptime` calls using a format string containing
28732873
a day of month without a year now emit a
2874-
:exc:`DeprecationWarning`. In 3.15 or later we may change this into
2875-
an error or change the default year to a leap year. See :gh:`70647`.
2874+
:exc:`DeprecationWarning`. In 3.18 we will change this into
2875+
an error or change the default year to a leap year.
28762876

28772877
.. rubric:: Footnotes
28782878

Lib/_strptime.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -475,10 +475,9 @@ def repl(m):
475475
import warnings
476476
warnings.warn("""\
477477
Parsing dates involving a day of month without a year specified is ambiguous
478-
and fails to parse leap day. The default behavior will change in a future Python
479-
version to either always raise an exception or to use a different default year.
480-
To avoid trouble, add a specific year to the input & format.
481-
See https://github.com/python/cpython/issues/70647.""",
478+
and fails to parse leap day. The default behavior will change in Python 3.18
479+
to either always raise an exception or to use a different default year.
480+
To avoid trouble, add a specific year to the input and format.""",
482481
DeprecationWarning,
483482
skip_file_prefixes=(os.path.dirname(__file__),))
484483
return format
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Include the ``%e`` format code in the :meth:`~datetime.datetime.strptime`
2+
deprecation for day-of-month format codes used without a year.

0 commit comments

Comments
 (0)