From: Alexander Belopolsky Date: Tue, 23 Aug 2016 18:44:51 +0000 (-0400) Subject: Issue #27834: Avoid overflow error in ZoneInfo.invert(). X-Git-Tag: v3.6.0b1~578 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7c7c14696bc8728e6853fba7595d6125d4eff238;p=python Issue #27834: Avoid overflow error in ZoneInfo.invert(). --- diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py index a0583072d9..e21d487a12 100644 --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py @@ -4477,11 +4477,11 @@ class ZoneInfo(tzinfo): @staticmethod def invert(ut, ti): - lt = (ut.__copy__(), ut.__copy__()) + lt = (array('q', ut), array('q', ut)) if ut: offset = ti[0][0] // SEC - lt[0][0] = max(-2**31, lt[0][0] + offset) - lt[1][0] = max(-2**31, lt[1][0] + offset) + lt[0][0] += offset + lt[1][0] += offset for i in range(1, len(ut)): lt[0][i] += ti[i-1][0] // SEC lt[1][i] += ti[i][0] // SEC