asyncio: Move loop attribute to _FlowControlMixin

Move the _loop attribute from the constructor of _SelectorTransport,
_ProactorBasePipeTransport and _UnixWritePipeTransport classes to the
constructor of the _FlowControlMixin class.

Add also an assertion to explicit that the parent class must ensure that the
loop is defined (not None)
This commit is contained in:
Victor Stinner 2014-11-05 15:27:41 +01:00
parent 7e8b8678f1
commit 004adb91f6
5 changed files with 8 additions and 8 deletions

View file

@ -447,7 +447,7 @@ class _SelectorTransport(transports._FlowControlMixin,
_buffer_factory = bytearray # Constructs initial value for self._buffer.
def __init__(self, loop, sock, protocol, extra, server=None):
super().__init__(extra)
super().__init__(extra, loop)
self._extra['socket'] = sock
self._extra['sockname'] = sock.getsockname()
if 'peername' not in self._extra:
@ -455,7 +455,6 @@ class _SelectorTransport(transports._FlowControlMixin,
self._extra['peername'] = sock.getpeername()
except socket.error:
self._extra['peername'] = None
self._loop = loop
self._sock = sock
self._sock_fd = sock.fileno()
self._protocol = protocol