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:
@@ -1020,6 +1020,9 @@ parse_hh_mm_ss_ff(const char *tstr, const char *tstr_end, int *hour,
|
||||
continue;
|
||||
}
|
||||
else if (c == '.' || c == ',') {
|
||||
if (i < 2) {
|
||||
return -3; // Decimal mark on hour or minute
|
||||
}
|
||||
break;
|
||||
} else if (!has_separator) {
|
||||
--p;
|
||||
|
||||
Reference in New Issue
Block a user