File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -259,7 +259,14 @@ def close(self):
259259 if self .file is not None :
260260 self .file .close ()
261261 if self .sock is not None :
262- self .sock .close ()
262+ try :
263+ self .sock .shutdown (socket .SHUT_RDWR )
264+ except socket .error as e :
265+ # The server might already have closed the connection
266+ if e .errno != errno .ENOTCONN :
267+ raise
268+ finally :
269+ self .sock .close ()
263270 self .file = self .sock = None
264271
265272 #__del__ = quit
Original file line number Diff line number Diff line change @@ -138,6 +138,9 @@ Core and Builtins
138138Library
139139-------
140140
141+ - Issue #4473: Ensure the socket is shutdown cleanly in POP3.close().
142+ Patch by Lorenzo Catucci.
143+
141144- Issue #16522: added FAIL_FAST flag to doctest.
142145
143146- Issue #15627: Add the importlib.abc.SourceLoader.compile_source() method.
You can’t perform that action at this time.
0 commit comments