[Python-checkins] [3.7] bpo-19376: Added doc mentioning `datetime.strptime()` without a year fails for Feb 29. (GH-10243)

Tal Einat webhook-mailer at python.org
Tue May 21 15:04:02 EDT 2019


https://github.com/python/cpython/commit/390d88e49c55c15fac7cdf60b649a4b9b15d189b
commit: 390d88e49c55c15fac7cdf60b649a4b9b15d189b
branch: 3.7
author: Tal Einat <taleinat+github at gmail.com>
committer: GitHub <noreply at github.com>
date: 2019-05-21T22:03:58+03:00
summary:

[3.7] bpo-19376: Added doc mentioning `datetime.strptime()` without a year fails for Feb 29. (GH-10243)

(cherry picked from commit 56027ccd6b9dab4a090e4fef8574933fb9a36ff2)

Co-authored-by: Abhishek Kumar Singh <toanant at users.noreply.github.com>

files:
M Doc/library/datetime.rst

diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst
index 1ee23c2175a2..00cfaeb66f5a 100644
--- a/Doc/library/datetime.rst
+++ b/Doc/library/datetime.rst
@@ -2031,6 +2031,9 @@ For :class:`date` objects, the format codes for hours, minutes, seconds, and
 microseconds should not be used, as :class:`date` objects have no such
 values.  If they're used anyway, ``0`` is substituted for them.
 
+For the :meth:`datetime.strptime` class method, the default value is ``1900-01-01T00:00:00.000``:
+any components not specified in the format string will be pulled from the default value. [#]_
+
 The full set of format codes supported varies across platforms, because Python
 calls the platform C library's :func:`strftime` function, and platform
 variations are common.  To see the full set of format codes supported on your
@@ -2265,3 +2268,4 @@ Notes:
 .. rubric:: Footnotes
 
 .. [#] If, that is, we ignore the effects of Relativity
+.. [#] Passing ``datetime.strptime('Feb 29', '%b %d')`` will fail since ``1900`` is not a leap year.



More information about the Python-checkins mailing list