agronholm / agronholm/anyio

Restore signal handlers at the end of `open_signal_receiver`.

未关闭
#689 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
Python
星标
2.5k
派生
260
平均合并
2 天 8 小时
30 天内合并 PR
19

描述

### Things to check first

- [X] I have searched the existing issues and didn't find my feature already requested there

### Feature description

Would it be possible to restore the original signal handlers at the end of `open_signal_receiver` instead of only removing them? I see that currently, we don't do that. Is there reason for this?

To restore signal handlers, they also have to be restored using ctypes after calling `remove_signal_handler`. See this code for an example on how to do that: https://github.com/prompt-toolkit/python-prompt-toolkit/blob/465ab02854763fafc0099a2e38a56328c1cb0625/src/prompt_toolkit/application/application.py#L1596

### Use case

(Use case is obvious I think. We have an application for which a main signal handler is installed at the beginning, however, during a portion of the code, we want to use `open_signal_receiver` to override the signal handler for that portion.)

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。