summaryrefslogtreecommitdiff
path: root/Lib/asyncio
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-11-05 15:27:41 +0100
committerVictor Stinner <victor.stinner@gmail.com>2014-11-05 15:27:41 +0100
commit5494ef6273d50f9d055527e512e10a7bf445e004 (patch)
tree4281db6b16a2ed44ca98be0dbc4cfe3f8ad15e10 /Lib/asyncio
parent661cba0fcc21c1904cdcd14431c53456b55b50e3 (diff)
downloadcpython-5494ef6273d50f9d055527e512e10a7bf445e004.tar.gz
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)
Diffstat (limited to 'Lib/asyncio')
-rw-r--r--Lib/asyncio/proactor_events.py3
-rw-r--r--Lib/asyncio/selector_events.py3
-rw-r--r--Lib/asyncio/transports.py4
-rw-r--r--Lib/asyncio/unix_events.py3
4 files changed, 6 insertions, 7 deletions
diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py
index 7132300a56..a1e2fef6d1 100644
--- a/Lib/asyncio/proactor_events.py
+++ b/Lib/asyncio/proactor_events.py
@@ -21,9 +21,8 @@ class _ProactorBasePipeTransport(transports._FlowControlMixin,
def __init__(self, loop, sock, protocol, waiter=None,
extra=None, server=None):
- super().__init__(extra)
+ super().__init__(extra, loop)
self._set_extra(sock)
- self._loop = loop
self._sock = sock
self._protocol = protocol
self._server = server
diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py
index c5debf8f02..116d380157 100644
--- a/Lib/asyncio/selector_events.py
+++ b/Lib/asyncio/selector_events.py
@@ -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
diff --git a/Lib/asyncio/transports.py b/Lib/asyncio/transports.py
index 3caf853f9e..22df3c7aed 100644
--- a/Lib/asyncio/transports.py
+++ b/Lib/asyncio/transports.py
@@ -238,8 +238,10 @@ class _FlowControlMixin(Transport):
resume_writing() may be called.
"""
- def __init__(self, extra=None):
+ def __init__(self, extra=None, loop=None):
super().__init__(extra)
+ assert loop is not None
+ self._loop = loop
self._protocol_paused = False
self._set_write_buffer_limits()
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py
index 93c8c1c819..b16f946ae4 100644
--- a/Lib/asyncio/unix_events.py
+++ b/Lib/asyncio/unix_events.py
@@ -369,9 +369,8 @@ class _UnixWritePipeTransport(transports._FlowControlMixin,
transports.WriteTransport):
def __init__(self, loop, pipe, protocol, waiter=None, extra=None):
- super().__init__(extra)
+ super().__init__(extra, loop)
self._extra['pipe'] = pipe
- self._loop = loop
self._pipe = pipe
self._fileno = pipe.fileno()
mode = os.fstat(self._fileno).st_mode