mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-37027: Return a proxy socket object from transp.get_extra_info('socket') (GH-13530)
Return a safe to use proxy socket object from `transport.get_extra_info('socket')` https://bugs.python.org/issue37027
This commit is contained in:
parent
674ee12600
commit
8cd5165ba0
7 changed files with 220 additions and 9 deletions
|
@ -19,6 +19,7 @@ from . import exceptions
|
|||
from . import protocols
|
||||
from . import sslproto
|
||||
from . import transports
|
||||
from . import trsock
|
||||
from .log import logger
|
||||
|
||||
|
||||
|
@ -454,7 +455,7 @@ class _ProactorSocketTransport(_ProactorReadPipeTransport,
|
|||
base_events._set_nodelay(sock)
|
||||
|
||||
def _set_extra(self, sock):
|
||||
self._extra['socket'] = sock
|
||||
self._extra['socket'] = trsock.TransportSocket(sock)
|
||||
|
||||
try:
|
||||
self._extra['sockname'] = sock.getsockname()
|
||||
|
@ -679,7 +680,7 @@ class BaseProactorEventLoop(base_events.BaseEventLoop):
|
|||
self.call_exception_handler({
|
||||
'message': 'Accept failed on a socket',
|
||||
'exception': exc,
|
||||
'socket': sock,
|
||||
'socket': trsock.TransportSocket(sock),
|
||||
})
|
||||
sock.close()
|
||||
elif self._debug:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue