summaryrefslogtreecommitdiff
path: root/Lib/_strptime.py
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2013-04-04 02:09:20 +0300
committerEzio Melotti <ezio.melotti@gmail.com>2013-04-04 02:09:20 +0300
commit69a9ce87abf6eee46ef3d434ec1c120ee6e02ee4 (patch)
tree8e0b7b0c0cbad2a685628715268625da40dcb575 /Lib/_strptime.py
parentfb91ce666cfcfce35b37260436106644919737d4 (diff)
downloadcpython-69a9ce87abf6eee46ef3d434ec1c120ee6e02ee4.tar.gz
#17572: Avoid chained exceptions while passing bad directives to time.strptime(). Initial patch by Claudiu Popa.
Diffstat (limited to 'Lib/_strptime.py')
-rw-r--r--Lib/_strptime.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/_strptime.py b/Lib/_strptime.py
index b0cd3d619e..b089b08541 100644
--- a/Lib/_strptime.py
+++ b/Lib/_strptime.py
@@ -326,7 +326,7 @@ def _strptime(data_string, format="%a %b %d %H:%M:%S %Y"):
bad_directive = "%"
del err
raise ValueError("'%s' is a bad directive in format '%s'" %
- (bad_directive, format))
+ (bad_directive, format)) from None
# IndexError only occurs when the format string is "%"
except IndexError:
raise ValueError("stray %% in format '%s'" % format)