summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/proactor_events.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-01-21 22:38:37 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-01-21 22:38:37 (GMT)
commitcd0f7f9832e6aa8363f85152810738111b9a181d (patch)
treefb93436a2bd38cd77a2f4d22ab243449e207325b /Lib/asyncio/proactor_events.py
parentb5684c48e1e37ff8fb1cf6cc42cae31bd2da37d8 (diff)
downloadcpython-cd0f7f9832e6aa8363f85152810738111b9a181d.zip
cpython-cd0f7f9832e6aa8363f85152810738111b9a181d.tar.gz
cpython-cd0f7f9832e6aa8363f85152810738111b9a181d.tar.bz2
asyncio: Enhance BaseProactorEventLoop._loop_self_reading()
* Handle correctly CancelledError: just exit * On error, log the exception and exit Don't try to close the event loop, it is probably running and so it cannot be closed.
Diffstat (limited to 'Lib/asyncio/proactor_events.py')
-rw-r--r--Lib/asyncio/proactor_events.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py
index 6d8641f..ed17062 100644
--- a/Lib/asyncio/proactor_events.py
+++ b/Lib/asyncio/proactor_events.py
@@ -463,9 +463,15 @@ class BaseProactorEventLoop(base_events.BaseEventLoop):
if f is not None:
f.result() # may raise
f = self._proactor.recv(self._ssock, 4096)
- except:
- self.close()
- raise
+ except futures.CancelledError:
+ # _close_self_pipe() has been called, stop waiting for data
+ return
+ except Exception as exc:
+ self.call_exception_handler({
+ 'message': 'Error on reading from the event loop self pipe',
+ 'exception': exc,
+ 'loop': self,
+ })
else:
self._self_reading_future = f
f.add_done_callback(self._loop_self_reading)