Skip to content

Commit

Permalink
adjust example code comments.
Browse files Browse the repository at this point in the history
To passively encourage people to include such comments in their own code
when adopting this mitigation...
  • Loading branch information
gpshead committed Apr 1, 2024
1 parent b12e7e5 commit d4c994e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Doc/library/datetime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ Other constructors, all class methods:

>>> from datetime import datetime
>>> date_string = "02/29"
>>> when = datetime.strptime(f"{date_string};1984", "%m/%d;%Y")
>>> when = datetime.strptime(f"{date_string};1984", "%m/%d;%Y") # Avoids leap year bug.
>>> when.strftime("%B %d") # doctest: +SKIP
'February 29'

Expand Down Expand Up @@ -2682,7 +2682,7 @@ Notes:
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!
>>> strptime(f"{month_day};1984", "%m/%d;%Y") # No leap year bug.

.. deprecated-removed:: 3.13 3.15
:meth:`~.datetime.strptime` calls using a format string containing
Expand Down

0 comments on commit d4c994e

Please sign in to comment.