bpo-37372: Fix error unpickling datetime.time objects from Python 2 with seconds>=24. (GH-14307)

This commit is contained in:
Justin Blanchard 2019-08-29 03:36:15 -04:00 committed by Serhiy Storchaka
parent e64f948e76
commit 122376df55
4 changed files with 22 additions and 10 deletions

View file

@ -4078,7 +4078,7 @@ time_new(PyTypeObject *type, PyObject *args, PyObject *kw)
return NULL;
}
if (PyUnicode_GET_LENGTH(state) == _PyDateTime_TIME_DATASIZE &&
(0x7F & PyUnicode_READ_CHAR(state, 2)) < 24)
(0x7F & PyUnicode_READ_CHAR(state, 0)) < 24)
{
state = PyUnicode_AsLatin1String(state);
if (state == NULL) {