diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-03-27 14:20:37 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-03-27 14:20:37 (GMT) |
commit | 6b3af083cab7bdd8772b2c2f12d282387de5e668 (patch) | |
tree | e515dea1e51d55640f58a211463a3a1b14243860 | |
parent | 59f6342c97cd369ec91893934c7b0a962b30c250 (diff) | |
parent | 79fd962652a60f04ecc7becb116c330063b1706e (diff) | |
download | cpython-6b3af083cab7bdd8772b2c2f12d282387de5e668.zip cpython-6b3af083cab7bdd8772b2c2f12d282387de5e668.tar.gz cpython-6b3af083cab7bdd8772b2c2f12d282387de5e668.tar.bz2 |
Merge 3.4 (asyncio)
-rw-r--r-- | Lib/asyncio/selector_events.py | 2 | ||||
-rw-r--r-- | Lib/test/test_asyncio/test_selector_events.py | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py index a38ed1c..68e9415 100644 --- a/Lib/asyncio/selector_events.py +++ b/Lib/asyncio/selector_events.py @@ -535,7 +535,7 @@ class _SelectorTransport(transports._FlowControlMixin, info.append('closing') info.append('fd=%s' % self._sock_fd) # test if the transport was closed - if self._loop is not None: + if self._loop is not None and not self._loop.is_closed(): polling = _test_selector_event(self._loop._selector, self._sock_fd, selectors.EVENT_READ) if polling: diff --git a/Lib/test/test_asyncio/test_selector_events.py b/Lib/test/test_asyncio/test_selector_events.py index f64e40d..9478b95 100644 --- a/Lib/test/test_asyncio/test_selector_events.py +++ b/Lib/test/test_asyncio/test_selector_events.py @@ -62,6 +62,11 @@ class BaseSelectorEventLoopTests(test_utils.TestCase): self.loop.add_reader._is_coroutine = False transport = self.loop._make_socket_transport(m, asyncio.Protocol()) self.assertIsInstance(transport, _SelectorSocketTransport) + + # Calling repr() must not fail when the event loop is closed + self.loop.close() + repr(transport) + close_transport(transport) @unittest.skipIf(ssl is None, 'No ssl module') |