@@ -207,9 +207,6 @@ def __repr__(self):
207
207
repr_args = "," .join ((f"{ k } ={ v } " for k , v in self .repr_pieces ()))
208
208
return f"{ self .__class__ .__name__ } <{ repr_args } >"
209
209
210
- def __del__ (self ):
211
- self ._close_socket ()
212
-
213
210
@abstractmethod
214
211
def repr_pieces (self ):
215
212
pass
@@ -380,26 +377,6 @@ async def disconnect(self, nowait: bool = False) -> None:
380
377
f"Timed out closing connection after { self .socket_connect_timeout } "
381
378
) from None
382
379
383
- def _close_socket (self ):
384
- """Close the socket directly. Used during garbage collection to
385
- make sure the underlying socket is released. This does not happen
386
- reliably when the stream is garbage collected. This is a safety
387
- precaution, correct use of the library should ensure that
388
- sockets are disconnected properly.
389
- """
390
- # some test classes don't even have this
391
- writer = getattr (self , "_writer" , None )
392
- if writer :
393
- if os .getpid () == self .pid :
394
- try :
395
- writer .close ()
396
- except RuntimeError :
397
- # This may fail if the event loop is already closed,
398
- # even though this is not an async call. In this
399
- # case, just ignore the error, since it is during
400
- # exit anyway.
401
- pass
402
-
403
380
async def _send_ping (self ):
404
381
"""Send PING, expect PONG in return"""
405
382
await self .send_command ("PING" , check_health = False )
0 commit comments