mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +00:00
- Issue #22841: Reject coroutines in asyncio add_signal_handler().
Patch by Ludovic.Gasc.
This commit is contained in:
parent
6c14f23100
commit
e36fcde383
3 changed files with 18 additions and 0 deletions
|
@ -63,6 +63,18 @@ class SelectorEventLoopSignalTests(test_utils.TestCase):
|
|||
self.loop.add_signal_handler,
|
||||
signal.SIGINT, lambda: True)
|
||||
|
||||
@mock.patch('asyncio.unix_events.signal')
|
||||
def test_add_signal_handler_coroutine_error(self, m_signal):
|
||||
|
||||
@asyncio.coroutine
|
||||
def simple_coroutine():
|
||||
yield from []
|
||||
|
||||
self.assertRaises(
|
||||
TypeError,
|
||||
self.loop.add_signal_handler,
|
||||
signal.SIGINT, simple_coroutine)
|
||||
|
||||
@mock.patch('asyncio.unix_events.signal')
|
||||
def test_add_signal_handler(self, m_signal):
|
||||
m_signal.NSIG = signal.NSIG
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue