Skip to content

Commit f13b289

Browse files
Move check
1 parent eacad9a commit f13b289

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Lib/zoneinfo/_common.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ def load_data(fobj):
6767
f">{timecnt}{time_type}", fobj.read(timecnt * time_size)
6868
)
6969
trans_idx = struct.unpack(f">{timecnt}B", fobj.read(timecnt))
70+
71+
if max(trans_idx) >= typecnt:
72+
raise ValueError("Invalid transition index found while reading TZif: "
73+
f"{max(trans_idx)}")
7074
else:
7175
trans_list_utc = ()
7276
trans_idx = ()
7377

74-
if trans_idx and max(trans_idx) >= typecnt:
75-
raise ValueError("Invalid transition index found while reading TZif: "
76-
f"{max(trans_idx)}")
77-
7878
# Read the ttinfo struct, (utoff, isdst, abbrind)
7979
if typecnt:
8080
utcoff, isdst, abbrind = zip(

0 commit comments

Comments
 (0)