summaryrefslogtreecommitdiffstats
path: root/Doc/library/time.rst
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2009-03-30 21:30:26 (GMT)
committerBrett Cannon <bcannon@gmail.com>2009-03-30 21:30:26 (GMT)
commit7f6b4f86e305ec63441657c57f5f546d15114ca0 (patch)
treef7b41eb0be99b61e60e35d9e36746c56ef0a5d7f /Doc/library/time.rst
parentd687887b536bf1674ac45f78bb77b346aa2b7687 (diff)
downloadcpython-7f6b4f86e305ec63441657c57f5f546d15114ca0.zip
cpython-7f6b4f86e305ec63441657c57f5f546d15114ca0.tar.gz
cpython-7f6b4f86e305ec63441657c57f5f546d15114ca0.tar.bz2
Make sure time.strptime only accepts strings (and document the fact like
strftime). Already didn't accept bytes but make the check earlier. This also lifts the limitation of requiring ASCII. Closes issue #5236. Thanks Tennessee Leeuwenburg.
Diffstat (limited to 'Doc/library/time.rst')
-rw-r--r--Doc/library/time.rst14
1 files changed, 8 insertions, 6 deletions
diff --git a/Doc/library/time.rst b/Doc/library/time.rst
index 46d972a..cdc623d 100644
--- a/Doc/library/time.rst
+++ b/Doc/library/time.rst
@@ -358,15 +358,17 @@ The module defines the following functions and data items:
.. function:: strptime(string[, format])
- Parse a string representing a time according to a format. The return value is
- a :class:`struct_time` as returned by :func:`gmtime` or :func:`localtime`.
+ Parse a string representing a time according to a format. The return value
+ is a :class:`struct_time` as returned by :func:`gmtime` or
+ :func:`localtime`.
The *format* parameter uses the same directives as those used by
:func:`strftime`; it defaults to ``"%a %b %d %H:%M:%S %Y"`` which matches the
- formatting returned by :func:`ctime`. If *string* cannot be parsed according to
- *format*, or if it has excess data after parsing, :exc:`ValueError` is raised.
- The default values used to fill in any missing data when more accurate values
- cannot be inferred are ``(1900, 1, 1, 0, 0, 0, 0, 1, -1)``.
+ formatting returned by :func:`ctime`. If *string* cannot be parsed according
+ to *format*, or if it has excess data after parsing, :exc:`ValueError` is
+ raised. The default values used to fill in any missing data when more
+ accurate values cannot be inferred are ``(1900, 1, 1, 0, 0, 0, 0, 1, -1)``.
+ Both *string* and *format* must be strings.
For example: