summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2016-08-23 14:44:51 -0400
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2016-08-23 14:44:51 -0400
commit7c7c14696bc8728e6853fba7595d6125d4eff238 (patch)
tree512df2ce18aa2fcbb23e6b463cae1f5a28e59eb2
parentc019bd3033eebe3c7bd25bdd6a4831f8345dc1af (diff)
downloadcpython-git-7c7c14696bc8728e6853fba7595d6125d4eff238.tar.gz
Issue #27834: Avoid overflow error in ZoneInfo.invert().
-rw-r--r--Lib/test/datetimetester.py6
1 files changed, 3 insertions, 3 deletions
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