summaryrefslogtreecommitdiff
path: root/asyncio/unix_events.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-11-20 15:03:16 +0100
committerVictor Stinner <victor.stinner@gmail.com>2014-11-20 15:03:16 +0100
commita88f2bc4659174b40cde546c545792733400bcf5 (patch)
tree3de11455e852794d098204212b430468db4b9feb /asyncio/unix_events.py
parent4377c749acb8e05dfd0fb762c860a4f29c99dd7a (diff)
downloadtrollius-a88f2bc4659174b40cde546c545792733400bcf5.tar.gz
Coroutine objects are now rejected with a TypeError by the following functions:
* add_signal_handler() * call_at() * call_later() * call_soon() * call_soon_threadsafe() * run_in_executor() Fix also the error message of add_signal_handler() (fix the name of the function).
Diffstat (limited to 'asyncio/unix_events.py')
-rw-r--r--asyncio/unix_events.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/asyncio/unix_events.py b/asyncio/unix_events.py
index e49212e..efe06d4 100644
--- a/asyncio/unix_events.py
+++ b/asyncio/unix_events.py
@@ -67,8 +67,9 @@ 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()")
+ if (coroutines.iscoroutine(callback)
+ or coroutines.iscoroutinefunction(callback)):
+ raise TypeError("coroutines cannot be used with add_signal_handler()")
self._check_signal(sig)
try:
# set_wakeup_fd() raises ValueError if this is not the