summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_plistlib.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-04-08 12:00:02 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-04-08 12:00:02 (GMT)
commit94ad49fabc15c2eaafb5b590701ceb642d56bec0 (patch)
treeaea81c8169370c8ace0c02a38511da35f6ba369b /Lib/test/test_plistlib.py
parent152a19c6bd59b772660c8af050248a196bb6a848 (diff)
downloadcpython-94ad49fabc15c2eaafb5b590701ceb642d56bec0.zip
cpython-94ad49fabc15c2eaafb5b590701ceb642d56bec0.tar.gz
cpython-94ad49fabc15c2eaafb5b590701ceb642d56bec0.tar.bz2
Issue #26709: Fixed Y2038 problem in loading binary PLists.
Diffstat (limited to 'Lib/test/test_plistlib.py')
-rw-r--r--Lib/test/test_plistlib.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_plistlib.py b/Lib/test/test_plistlib.py
index fef9f39..f0e9e5a 100644
--- a/Lib/test/test_plistlib.py
+++ b/Lib/test/test_plistlib.py
@@ -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):