Issue 35465: [asyncio] Document loop.add_signal_handler
Created on 2018-12-11 19:21 by hniksic, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 11145 | merged | python-dev, 2018-12-13 19:54 | |
| PR 11221 | merged | miss-islington, 2018-12-18 21:31 | |
| Messages (5) | |||
|---|---|---|---|
| msg331645 - (view) | Author: Hrvoje Nikšić (hniksic) * | Date: 2018-12-11 19:21 | |
In https://stackoverflow.com/q/53704709/1600898 a StackOverflow user asked how the add_signal_handler event loop method differs from the signal.signal normally used by Python code. The add_signal_handler documentation is quite brief - if we exclude the parts that explain the exceptions raised and how to pass keyword arguments to the callback, the meat is this sentence: Set callback as the handler for the signum signal. It is only after looking at the source, and understanding asyncio, that one comes to the conclusion that the idea is to run the handler along with other event loop callbacks and coroutines, at the time when it is actually safe to invoke asyncio code. I think this deserves to be mentioned explicitly, for example: Set callback as the handler for the signum signal. The callback will be invoked in the thread that runs the event loop, along with other queued callbacks and runnable coroutines. Unlike signal handlers registered using signal.signal(), a callback registered with this function is allowed to interact with the event loop. |
|||
| msg331708 - (view) | Author: Andrew Svetlov (asvetlov) * ![]() |
Date: 2018-12-12 16:43 | |
The proposal sounds great! Would you prepare a pull request for docs update? |
|||
| msg331767 - (view) | Author: Hrvoje Nikšić (hniksic) * | Date: 2018-12-13 19:55 | |
Done, https://github.com/python/cpython/pull/11145 |
|||
| msg332081 - (view) | Author: Yury Selivanov (yselivanov) * ![]() |
Date: 2018-12-18 21:31 | |
New changeset e3666fc8effb05b555121f4ab7388df59e21f8b4 by Yury Selivanov (Hrvoje Nikšić) in branch 'master': bpo-35465: Document _UnixSelectorEventLoop.add_signal_handler. (GH-11145) https://github.com/python/cpython/commit/e3666fc8effb05b555121f4ab7388df59e21f8b4 |
|||
| msg332085 - (view) | Author: Yury Selivanov (yselivanov) * ![]() |
Date: 2018-12-18 21:52 | |
New changeset 12f3979b3807b448ca070b44bbc1597cf800f8a4 by Yury Selivanov (Miss Islington (bot)) in branch '3.7': bpo-35465: Document _UnixSelectorEventLoop.add_signal_handler. (GH-11145) (GH-11221) https://github.com/python/cpython/commit/12f3979b3807b448ca070b44bbc1597cf800f8a4 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:09 | admin | set | github: 79646 |
| 2018-12-18 21:52:40 | yselivanov | set | messages: + msg332085 |
| 2018-12-18 21:32:49 | yselivanov | set | status: open -> closed type: enhancement resolution: fixed stage: patch review -> resolved |
| 2018-12-18 21:31:41 | miss-islington | set | pull_requests: + pull_request10456 |
| 2018-12-18 21:31:37 | yselivanov | set | messages: + msg332081 |
| 2018-12-13 19:55:57 | hniksic | set | messages: + msg331767 |
| 2018-12-13 19:54:27 | python-dev | set | keywords:
+ patch stage: patch review pull_requests: + pull_request10376 |
| 2018-12-12 20:57:26 | asvetlov | set | nosy:
+ yselivanov components: + asyncio |
| 2018-12-12 20:18:36 | brett.cannon | set | title: Document add_signal_handler -> [asyncio] Document loop.add_signal_handler |
| 2018-12-12 16:43:30 | asvetlov | set | nosy:
+ asvetlov messages: + msg331708 |
| 2018-12-11 19:21:33 | hniksic | create | |
