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