mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
Issue #26709: Fixed Y2038 problem in loading binary PLists.
This commit is contained in:
parent
152a19c6bd
commit
94ad49fabc
3 changed files with 12 additions and 1 deletions
|
|
@ -428,6 +428,15 @@ class TestPlistlib(unittest.TestCase):
|
|||
b'\x00\x00\x00\x00\x00\x00\x00\x13')
|
||||
self.assertEqual(plistlib.loads(data), {'a': 'b'})
|
||||
|
||||
def test_large_timestamp(self):
|
||||
# Issue #26709: 32-bit timestamp out of range
|
||||
for ts in -2**31-1, 2**31:
|
||||
with self.subTest(ts=ts):
|
||||
d = (datetime.datetime.utcfromtimestamp(0) +
|
||||
datetime.timedelta(seconds=ts))
|
||||
data = plistlib.dumps(d, fmt=plistlib.FMT_BINARY)
|
||||
self.assertEqual(plistlib.loads(data), d)
|
||||
|
||||
|
||||
class TestPlistlibDeprecated(unittest.TestCase):
|
||||
def test_io_deprecated(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue