You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2019-08-29.08:12:38.004>created_at=<Date2019-06-22.16:15:13.660>labels= ['3.7', '3.8', 'type-bug', 'library', '3.9']
title='datetime.time unpickling fails in case of python2 pickle with seconds>=24'updated_at=<Date2019-08-29.08:12:38.003>user='https://github.com/UncombedCoconut'
Under bpo-22005, Python 3 gained support for unpickling datetime data from Python 2. (Thanks!) It turns out the input validation isn't quite right: it bombs on datetime.time when the encoded seconds (not hours) field is >=24:
python2>>> datetime.time(1, 2, 3).__reduce__()
(<type 'datetime.time'>, ('\x01\x02\x03\x00\x00\x00',))
python2>>> datetime.time(23, 24, 25).__reduce__()
(<type 'datetime.time'>, ('\x17\x18\x19\x00\x00\x00',))
python3>>> datetime.time('\x01\x02\x03\x00\x00\x00')
datetime.time(1, 2, 3)
python3>>> datetime.time('\x17\x18\x19\x00\x00\x00')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: an integer is required (got type str)
I would like to contribute a fix and will be opening a PR. This is my first contribution - any help and patience appreciated!
New changeset 122376d by Serhiy Storchaka (Justin Blanchard) in branch 'master': bpo-37372: Fix error unpickling datetime.time objects from Python 2 with seconds>=24. (GH-14307) 122376d
New changeset d1d42bf by Miss Islington (bot) in branch '3.8': bpo-37372: Fix error unpickling datetime.time objects from Python 2 with seconds>=24. (GH-14307) d1d42bf
New changeset 6b50c10 by Miss Islington (bot) in branch '3.7': bpo-37372: Fix error unpickling datetime.time objects from Python 2 with seconds>=24. (GH-14307) 6b50c10
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: