mirror of
https://github.com/python/cpython.git
synced 2026-03-02 02:51:10 +00:00
[3.12] Fix undefined behaviour in datetime.time.fromisoformat() (GH-111982) (#111992)
Fix undefined behaviour in datetime.time.fromisoformat() (GH-111982)
Fix undefined behaviour in datetime.time.fromisoformat() when parsing a string without a timezone. 'tzoffset' is not assigned to by parse_isoformat_time if it returns 0, but time_fromisoformat then passes tzoffset to another function, which is undefined behaviour (even if the function in question does not use the value).
(cherry picked from commit 21615f77b5)
Co-authored-by: T. Wouters <thomas@python.org>
This commit is contained in:
parent
0f7671cc69
commit
1afc4dc3e6
1 changed files with 1 additions and 1 deletions
|
|
@ -4620,7 +4620,7 @@ time_fromisoformat(PyObject *cls, PyObject *tstr) {
|
|||
}
|
||||
|
||||
int hour = 0, minute = 0, second = 0, microsecond = 0;
|
||||
int tzoffset, tzimicrosecond = 0;
|
||||
int tzoffset = 0, tzimicrosecond = 0;
|
||||
int rv = parse_isoformat_time(p, len,
|
||||
&hour, &minute, &second, µsecond,
|
||||
&tzoffset, &tzimicrosecond);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue