Skip to content

Commit 9b4a015

Browse files
committed
Simplify tm_gmtoff lookup
1 parent e872568 commit 9b4a015

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

Lib/imaplib.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1869,10 +1869,7 @@ def Time2Internaldate(date_time):
18691869
dt = datetime.fromtimestamp(date_time,
18701870
timezone.utc).astimezone()
18711871
elif isinstance(date_time, tuple):
1872-
try:
1873-
gmtoff = date_time.tm_gmtoff
1874-
except AttributeError:
1875-
gmtoff = None
1872+
gmtoff = getattr(date_time, "tm_gmtoff", None)
18761873
if gmtoff is None:
18771874
if time.daylight:
18781875
dst = date_time[8]

0 commit comments

Comments
 (0)