diff options
author | Raymond Hettinger <python@rcn.com> | 2003-07-13 01:31:38 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2003-07-13 01:31:38 (GMT) |
commit | 4a6302b6fe1a0acb85267677a9be2ee925cf8248 (patch) | |
tree | f277b3b2411c2d0502fa17aa686d39d941501c53 /Lib/_strptime.py | |
parent | 627273733fd8c885e2b798581c530708cfee4514 (diff) | |
download | cpython-4a6302b6fe1a0acb85267677a9be2ee925cf8248.zip cpython-4a6302b6fe1a0acb85267677a9be2ee925cf8248.tar.gz cpython-4a6302b6fe1a0acb85267677a9be2ee925cf8248.tar.bz2 |
SF 748201: time.strptime() should display format and date on error
Usability fix. Makes the error message more helpful.
Diffstat (limited to 'Lib/_strptime.py')
-rw-r--r-- | Lib/_strptime.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/_strptime.py b/Lib/_strptime.py index ba9dde0..635613e 100644 --- a/Lib/_strptime.py +++ b/Lib/_strptime.py @@ -430,7 +430,8 @@ def strptime(data_string, format="%a %b %d %H:%M:%S %Y"): _regex_cache[format] = format_regex found = format_regex.match(data_string) if not found: - raise ValueError("time data did not match format") + raise ValueError("time data did not match format: data=%s fmt=%s" % + (data_string, format)) if len(data_string) != found.end(): raise ValueError("unconverted data remains: %s" % data_string[found.end():]) |