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

(cherry picked from commit 122376df55)

Co-authored-by: Justin Blanchard <UncombedCoconut@gmail.com>
This commit is contained in:
Miss Islington (bot) 2019-08-29 00:56:04 -07:00 committed by GitHub
parent 097eae5b9b
commit d1d42bf4a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 10 deletions

View file

@ -4081,7 +4081,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) {