summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_strptime.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-11-24 16:15:37 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-11-24 16:15:37 (GMT)
commitcdac302af362f275f31c13e143f78ec682ef7b68 (patch)
tree67f2c16bfe74aa6d1421627955e49ff5389d186b /Lib/test/test_strptime.py
parent44d2429a25589950284bd13c9343657e73f4927f (diff)
downloadcpython-cdac302af362f275f31c13e143f78ec682ef7b68.zip
cpython-cdac302af362f275f31c13e143f78ec682ef7b68.tar.gz
cpython-cdac302af362f275f31c13e143f78ec682ef7b68.tar.bz2
Issue #19545: Avoid chained exceptions while passing stray % to
time.strptime(). Initial patch by Claudiu Popa.
Diffstat (limited to 'Lib/test/test_strptime.py')
-rw-r--r--Lib/test/test_strptime.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_strptime.py b/Lib/test/test_strptime.py
index 68e6a67..d5bc39d 100644
--- a/Lib/test/test_strptime.py
+++ b/Lib/test/test_strptime.py
@@ -223,6 +223,10 @@ class StrptimeTests(unittest.TestCase):
with self.assertRaises(ValueError) as e:
_strptime._strptime_time('', '%D')
self.assertIs(e.exception.__suppress_context__, True)
+ # additional check for IndexError branch (issue #19545)
+ with self.assertRaises(ValueError) as e:
+ _strptime._strptime_time('19', '%Y %')
+ self.assertIs(e.exception.__suppress_context__, True)
def test_unconverteddata(self):
# Check ValueError is raised when there is unconverted data