mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #27834: Avoid overflow error in ZoneInfo.invert().
This commit is contained in:
parent
c019bd3033
commit
7c7c14696b
1 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue