Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d79f3c8

Browse files
committed
Issue #4471: Properly shutdown socket in IMAP.shutdown(). Patch by
Lorenzo M. Catucci.
1 parent b1436f1 commit d79f3c8

4 files changed

Lines changed: 6 additions & 0 deletions

File tree

Lib/imaplib.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ def send(self, data):
260260
def shutdown(self):
261261
"""Close I/O established in "open"."""
262262
self.file.close()
263+
self.sock.shutdown(socket.SHUT_RDWR)
263264
self.sock.close()
264265

265266

Lib/test/test_imaplib.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ def test_anonlogin(self):
217217

218218
def test_logout(self):
219219
rs = self.server.logout()
220+
self.server = None
220221
self.assertEqual(rs[0], 'BYE')
221222

222223

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ Tony Campbell
130130
Brett Cannon
131131
Mike Carlton
132132
Terry Carroll
133+
Lorenzo M. Catucci
133134
Donn Cave
134135
Charles Cazabon
135136
Per Cederqvist

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ Core and Builtins
6060
Library
6161
-------
6262

63+
- Issue #4471: Properly shutdown socket in IMAP.shutdown(). Patch by
64+
Lorenzo M. Catucci.
65+
6366
- Fix IMAP.login() to work properly.
6467

6568
- Issue #9244: multiprocessing pool worker processes could terminate

0 commit comments

Comments
 (0)