Skip to content

Commit 53c7a19

Browse files
author
Forest
committed
imaplib: simplify check for socket object
1 parent dcd0161 commit 53c7a19

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Lib/imaplib.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,8 +1379,7 @@ class Idler:
13791379
def __init__(self, imap, duration=None):
13801380
if 'IDLE' not in imap.capabilities:
13811381
raise imap.error("Server does not support IMAP4 IDLE")
1382-
if (duration is not None and
1383-
not isinstance(imap.sock, socket.socket)):
1382+
if duration is not None and not imap.sock:
13841383
# IMAP4_stream pipes don't support timeouts
13851384
raise imap.error('duration requires a socket connection')
13861385
self._duration = duration
@@ -1562,7 +1561,7 @@ def burst(self, interval=0.1):
15621561
15631562
Note: This generator requires a socket connection (not IMAP4_stream).
15641563
"""
1565-
if not isinstance(self._imap.sock, socket.socket):
1564+
if not self._imap.sock:
15661565
raise self._imap.error('burst() requires a socket connection')
15671566

15681567
try:

0 commit comments

Comments
 (0)