summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/unix_events.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2014-11-14 19:45:47 (GMT)
committerGuido van Rossum <guido@python.org>2014-11-14 19:45:47 (GMT)
commite36fcde38309f116c6c06042ad80e7debb7db743 (patch)
treef07b4d597d613ab70b2471f90f8c7e449de16ef2 /Lib/asyncio/unix_events.py
parent6c14f231005a2a3a63bd4b0157c908e94bd834ac (diff)
downloadcpython-e36fcde38309f116c6c06042ad80e7debb7db743.zip
cpython-e36fcde38309f116c6c06042ad80e7debb7db743.tar.gz
cpython-e36fcde38309f116c6c06042ad80e7debb7db743.tar.bz2
- Issue #22841: Reject coroutines in asyncio add_signal_handler().
Patch by Ludovic.Gasc.
Diffstat (limited to 'Lib/asyncio/unix_events.py')
-rw-r--r--Lib/asyncio/unix_events.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py
index b16f946..e49212e 100644
--- a/Lib/asyncio/unix_events.py
+++ b/Lib/asyncio/unix_events.py
@@ -13,6 +13,7 @@ import threading
from . import base_events
from . import base_subprocess
from . import constants
+from . import coroutines
from . import events
from . import selector_events
from . import selectors
@@ -66,6 +67,8 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop):
Raise ValueError if the signal number is invalid or uncatchable.
Raise RuntimeError if there is a problem setting up the handler.
"""
+ if coroutines.iscoroutinefunction(callback):
+ raise TypeError("coroutines cannot be used with call_soon()")
self._check_signal(sig)
try:
# set_wakeup_fd() raises ValueError if this is not the