]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-70647: Better promote how to safely parse yearless dates in datetime. ...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 21 Dec 2025 06:52:55 +0000 (07:52 +0100)
committerGitHub <noreply@github.com>
Sun, 21 Dec 2025 06:52:55 +0000 (06:52 +0000)
commit362d11e54543ed9edf8cbcc6f1afe6ab1d15d0cb
treec960228e33ccee6aa53f8cd1227a9fcc3ace65ac
parent27648a1818749ef44c420afe6173af6868715437
[3.14] gh-70647: Better promote how to safely parse yearless dates in datetime. (GH-116179) (#143037)

gh-70647: Better promote how to safely parse yearless dates in datetime. (GH-116179)

* gh-70647: Better promote how to safely parse yearless dates in datetime.

Every four years people encounter this because it just isn't obvious.
This moves the footnote up to a note with a code example.

We'd love to change the default year value for datetime but doing
that could have other consequences for existing code.  This documented
workaround *always* works.

* doctest code within note is bad, dedent.

* Update to match the error message.

* remove no longer referenced footnote

* ignore the warning in the doctest

* use Petr's suggestion for the docs to hide the warning processing

* cover date.strptime (3.14) as well
(cherry picked from commit b8d3fddba6e96e693ced0d3b8f6ddbd61428fd32)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
Doc/library/datetime.rst