mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Issue #19545: Avoid chained exceptions while passing stray % to
time.strptime(). Initial patch by Claudiu Popa.
This commit is contained in:
commit
b5d386314f
4 changed files with 12 additions and 1 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue