New submission from Justin Blanchard <uncombedcoco...@gmail.com>:
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! ---------- components: Library (Lib) messages: 346284 nosy: Justin Blanchard priority: normal severity: normal status: open title: datetime.time unpickling fails in case of python2 pickle with seconds>=24 type: behavior versions: Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue37372> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com