gh-115225: Raise error on unsupported ISO 8601 time strings (#119339)

Some time strings that contain fractional hours or minutes are permitted
by ISO 8601, but such strings are very unlikely to be intentional. The
current parser does not parse such strings correctly or raise an error.
This change raises a ValueError when hours or minutes contain a decimal mark.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
This commit is contained in:
benchatt 2024-06-05 10:35:40 -07:00 committed by GitHub
parent 10eac0269b
commit 14e3c7071b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 7 additions and 0 deletions

View file

@ -4412,6 +4412,8 @@ class TestTimeTZ(TestTime, TZInfoBase, unittest.TestCase):
'12:30:45.123456-', # Extra at end of microsecond time
'12:30:45.123456+', # Extra at end of microsecond time
'12:30:45.123456+12:00:30a', # Extra at end of full time
'12.5', # Decimal mark at end of hour
'12:30,5', # Decimal mark at end of minute
]
for bad_str in bad_strs: