External pager resets custom SIGINT handlers to SIG_DFL
评估
调研方向
从 More() 开始,在 fire/console/console_io.py 中检查外部分页器的运行方式以及异常处理方式。在 SIGINT 被忽略之前保存当前活动的处理程序,然后确保分页器退出后恢复该处理程序,包括发生异常时。完成的标准是两种情况下之前的处理程序都仍处于安装状态;issue 没有提供测试文件,因此请为此行为确定一个合适的测试。
由索引模型根据 Issue 内容生成。
描述
In fire/console/console_io.py, the More() function temporarily ignores SIGINT while an external pager runs.
However, it restores SIG_DFL instead of the handler previously installed by the application.
Problematic code
signal.signal(signal.SIGINT, signal.SIG_IGN)
# Execute external pager
signal.signal(signal.SIGINT, signal.SIG_DFL)
Expected behavior
The function should preserve the existing signal handler and restore it after the pager exits, including when an exception occurs.
Actual behavior
Based on the code, applications using custom SIGINT handlers lose their original handler after pager execution. Exceptions may also leave SIGINT ignored.
Suggested fix
Save the original handler and restore it in a finally block.
Testing
Identified through source-code inspection. An interactive pager reproduction has not yet been executed.
- 主要语言
- Python
- 星标
- 28.2k
- 派生
- 1.5k
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
google/python-fire 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
google/python-fire#733 ·
-
EllipsisMiddleTruncate exceeds requested width when only the ellipsis fits可能已有人在做 @hugosmoreira 于 14 天前认领。 未关闭
难度 1/5 1-3 小时 新手友好度 88/100
google/python-fire#722 · 1 条评论 ·
-
Windows ANSI initialization uses nonexistent subprocess.STD_OUTPUT_HANDLE可能已有人在做 @Fire162 于 11 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
google/python-fire#721 · 1 条评论 ·
-
Setup docs still say `python setup.py install`, but `setup.py` was removed可能已有人在做 @GreedyC 于 18 天前认领。 未关闭
难度 1/5 1-3 小时 新手友好度 93/100
google/python-fire#718 · 1 条评论 ·
-
Calling an async command from an active event loop raises RuntimeError and leaves an unawaited coroutine可能已有人在做 @aashish254 于 20 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
google/python-fire#716 ·
查看 google/python-fire 的全部 Issue
相似的 Issue
-
`destroy` sans terminal répond « Aborted. » au lieu de réclamer `--yes` comme `clean` et `reset`未关闭bug
难度 2/5 1-3 小时 新手友好度 85/100
stephrobert/dsoxlab#354 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 77/100
jasonacox/pypowerwall#472 ·
维护者通常 1 天内回复
-
[Bug]: DoubleMLRDDData accepts a score_col that is no data column (as in its docstring example); the running variable then becomes a covariate and RDFlex fails可能已有人在做 @vrjdev 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
DoubleML/doubleml-for-py#455 ·
维护者通常 1 天内回复
-
[Bug]: Python mod.Box[T] annotation gets a false generic_arg edge that replaces the parameter_type one ('is' on tree-sitter nodes)可能已有人在做 @rohit-jsfreaky 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
Graphify-Labs/graphify#5110 · 1 条评论 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
assafelovic/gpt-researcher#2277 ·
维护者通常 10 天内回复