python / python/cpython

Embedded use vs. signal handlers

未关闭
#93,411 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

3.13 stdlib type-feature
主要语言
Python
星标
77.2k
派生
36k
PR 合并指标
PR 指标待抓取

描述

Enhancement

C signal handlers should be restore-able. Ideally you also want to call them from Python.

signal.signal(signal.SIGINT, signal.getsignal(signal.SIGINT))

This (ostensibly no-op) code raises TypeError when you use it in an embedded Python interpreter and a signal handler has been installed by the C (or whatever) side.

It shouldn't. My Python code wants to be able to restore the signal handler to its previous state when it's done.

Ideally my code should also be able to wrap that C handler, i.e. the result of getsignal() should be a callable from Python.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

未指定源文件或测试。首先检查针对嵌入式 Python 解释器所描述的 signal.signal 和 signal.getsignal 行为,包括由 C 安装的处理程序;done 应允许恢复之前的处理程序,并在可行的情况下将其作为 Python 可以包装的可调用对象公开。

由索引模型根据 Issue 内容生成。

评估

技术栈
c, python
领域
operating-systems
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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