diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-11-24 16:15:37 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-11-24 16:15:37 (GMT) |
commit | cdac302af362f275f31c13e143f78ec682ef7b68 (patch) | |
tree | 67f2c16bfe74aa6d1421627955e49ff5389d186b /Lib/test/test_time.py | |
parent | 44d2429a25589950284bd13c9343657e73f4927f (diff) | |
download | cpython-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_time.py')
-rw-r--r-- | Lib/test/test_time.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py index faf9779..d8d6029 100644 --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -198,6 +198,10 @@ class TimeTestCase(unittest.TestCase): with self.assertRaises(ValueError) as e: time.strptime('', '%D') self.assertIs(e.exception.__suppress_context__, True) + # additional check for IndexError branch (issue #19545) + with self.assertRaises(ValueError) as e: + time.strptime('19', '%Y %') + self.assertIs(e.exception.__suppress_context__, True) def test_asctime(self): time.asctime(time.gmtime(self.t)) |