Skip to content

Commit

Permalink
minor doc cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
gpshead committed Apr 1, 2024
1 parent 333ba57 commit b12e7e5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Doc/library/datetime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2678,17 +2678,17 @@ Notes:
(10)
When parsing a month and day using :meth:`~.datetime.strptime`, always
include a year in the format. If the value you need to parse lacks a year,
just append an explicit dummy leap year. Otherwise your code will raise an
exception when it encounters leap day as the default year used by the parser
is not a leap year. Users run into this bug every four years...
append an explicit dummy leap year. Otherwise your code will raise an
exception when it encounters leap day because the default year used by the
parser is not a leap year. Users run into this bug every four years...

>>> strptime(f"{month_day};1984", "%m/%d;%Y") # problem mitigated!

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

.. rubric:: Footnotes

Expand Down

0 comments on commit b12e7e5

Please sign in to comment.