cpython: 79e33578dc05 (original) (raw)
Mercurial > cpython
changeset 80573:79e33578dc05
Issue #4473: Ensure the socket is shutdown cleanly in POP3.close(). Patch by Lorenzo Catucci. [#4473]
Antoine Pitrou solipsis@pitrou.net | |
---|---|
date | Fri, 23 Nov 2012 20:04:45 +0100 |
parents | a728056347ec |
children | d30fd9834cec |
files | Lib/poplib.py Misc/NEWS |
diffstat | 2 files changed, 11 insertions(+), 1 deletions(-)[+] [-] Lib/poplib.py 9 Misc/NEWS 3 |
line wrap: on
line diff
--- a/Lib/poplib.py +++ b/Lib/poplib.py @@ -259,7 +259,14 @@ class POP3: if self.file is not None: self.file.close() if self.sock is not None:
self.sock.close()[](#l1.7)
try:[](#l1.8)
self.sock.shutdown(socket.SHUT_RDWR)[](#l1.9)
except socket.error as e:[](#l1.10)
# The server might already have closed the connection[](#l1.11)
if e.errno != errno.ENOTCONN:[](#l1.12)
raise[](#l1.13)
finally:[](#l1.14)
self.sock.close()[](#l1.15) self.file = self.sock = None[](#l1.16)
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -138,6 +138,9 @@ Core and Builtins Library ------- +- Issue #4473: Ensure the socket is shutdown cleanly in POP3.close().