summaryrefslogtreecommitdiff
path: root/Lib/_strptime.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-11-24 18:15:37 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2013-11-24 18:15:37 +0200
commit901b549ff19913b7dd66e515d946bdf2bf991a1b (patch)
treecec1d6695aa468e1a50ecdbc6e9032e3b1ec96ee /Lib/_strptime.py
parent9dfd5808217000e69def16500044d63e36233a17 (diff)
downloadcpython-901b549ff19913b7dd66e515d946bdf2bf991a1b.tar.gz
Issue #19545: Avoid chained exceptions while passing stray % 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 264d4fa2ed..9058a69861 100644
--- a/Lib/_strptime.py
+++ b/Lib/_strptime.py
@@ -329,7 +329,7 @@ def _strptime(data_string, format="%a %b %d %H:%M:%S %Y"):
(bad_directive, format)) from None
# IndexError only occurs when the format string is "%"
except IndexError:
- raise ValueError("stray %% in format '%s'" % format)
+ raise ValueError("stray %% in format '%s'" % format) from None
_regex_cache[format] = format_regex
found = format_regex.match(data_string)
if not found: