@@ -348,6 +348,8 @@ async def sock_recv(self, sock, n):
348
348
The maximum amount of data to be received at once is specified by
349
349
nbytes.
350
350
"""
351
+ if isinstance (sock , ssl .SSLSocket ):
352
+ raise TypeError ("Socket cannot be of type SSLSocket" )
351
353
if self ._debug and sock .gettimeout () != 0 :
352
354
raise ValueError ("the socket must be non-blocking" )
353
355
try :
@@ -386,6 +388,8 @@ async def sock_recv_into(self, sock, buf):
386
388
The received data is written into *buf* (a writable buffer).
387
389
The return value is the number of bytes written.
388
390
"""
391
+ if isinstance (sock , ssl .SSLSocket ):
392
+ raise TypeError ("Socket cannot be of type SSLSocket" )
389
393
if self ._debug and sock .gettimeout () != 0 :
390
394
raise ValueError ("the socket must be non-blocking" )
391
395
try :
@@ -425,6 +429,8 @@ async def sock_sendall(self, sock, data):
425
429
raised, and there is no way to determine how much data, if any, was
426
430
successfully processed by the receiving end of the connection.
427
431
"""
432
+ if isinstance (sock , ssl .SSLSocket ):
433
+ raise TypeError ("Socket cannot be of type SSLSocket" )
428
434
if self ._debug and sock .gettimeout () != 0 :
429
435
raise ValueError ("the socket must be non-blocking" )
430
436
try :
@@ -472,6 +478,8 @@ async def sock_connect(self, sock, address):
472
478
473
479
This method is a coroutine.
474
480
"""
481
+ if isinstance (sock , ssl .SSLSocket ):
482
+ raise TypeError ("Socket cannot be of type SSLSocket" )
475
483
if self ._debug and sock .gettimeout () != 0 :
476
484
raise ValueError ("the socket must be non-blocking" )
477
485
@@ -533,6 +541,8 @@ async def sock_accept(self, sock):
533
541
object usable to send and receive data on the connection, and address
534
542
is the address bound to the socket on the other end of the connection.
535
543
"""
544
+ if isinstance (sock , ssl .SSLSocket ):
545
+ raise TypeError ("Socket cannot be of type SSLSocket" )
536
546
if self ._debug and sock .gettimeout () != 0 :
537
547
raise ValueError ("the socket must be non-blocking" )
538
548
fut = self .create_future ()
0 commit comments