Commit 7c7c1469 authored by Alexander Belopolsky's avatar Alexander Belopolsky

Issue #27834: Avoid overflow error in ZoneInfo.invert().

parent c019bd30
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment