MCPcopy Index your code
hub / github.com/RustPython/RustPython / close

Method close

Lib/poplib.py:294–315  ·  view source on GitHub ↗

Close the connection without assuming anything about it.

(self)

Source from the content-addressed store, hash-verified

292 return resp
293
294 def close(self):
295 """Close the connection without assuming anything about it."""
296 try:
297 file = self.file
298 self.file = None
299 if file is not None:
300 file.close()
301 finally:
302 sock = self.sock
303 self.sock = None
304 if sock is not None:
305 try:
306 sock.shutdown(socket.SHUT_RDWR)
307 except OSError as exc:
308 # The server might already have closed the connection.
309 # On Windows, this may result in WSAEINVAL (error 10022):
310 # An invalid operation was attempted.
311 if (exc.errno != errno.ENOTCONN
312 and getattr(exc, 'winerror', 0) != 10022):
313 raise
314 finally:
315 sock.close()
316
317 #__del__ = quit
318

Callers 4

quitMethod · 0.95
testTimeoutDefaultMethod · 0.95
testTimeoutNoneMethod · 0.95
testTimeoutValueMethod · 0.95

Calls 2

getattrFunction · 0.85
shutdownMethod · 0.45

Tested by 3

testTimeoutDefaultMethod · 0.76
testTimeoutNoneMethod · 0.76
testTimeoutValueMethod · 0.76