mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
asyncio: 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).
This commit is contained in:
parent
c1ad35aae8
commit
2d99d93d11
4 changed files with 35 additions and 21 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue