Embedding: TypeError: signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object
未關閉
還沒有人認領這個 Issue。
interpreter-core
topic-C-API
type-bug
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 35.9k
- PR 合併指標
- PR 指標待擷取
描述
Bug report
Bug description:
When using PEP 578 and 551 entry points to log python activity on Fedora-41, it results in above error.
setting TERM=dumb is a valid workaround
build ok (tested on Fedora 41/python 3.13.2)
usage nok (TypeError, see readme.md)
$ ./spython
Python 3.13.2 (main, Feb 4 2025, 00:00:00) [GCC 14.2.1 20250110 (Red Hat 14.2.1-7)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print("hello")
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/usr/lib64/python3.13/_pyrepl/__main__.py", line 6, in <module>
__pyrepl_interactive_console()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/lib64/python3.13/_pyrepl/main.py", line 59, in interactive_console
run_multiline_interactive_console(console)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/usr/lib64/python3.13/_pyrepl/simple_interact.py", line 143, in run_multiline_interactive_console
statement = multiline_input(more_lines, ps1, ps2)
File "/usr/lib64/python3.13/_pyrepl/readline.py", line 389, in multiline_input
return reader.readline()
~~~~~~~~~~~~~~~^^
File "/usr/lib64/python3.13/_pyrepl/reader.py", line 806, in readline
self.restore()
~~~~~~~~~~~~^^
File "/usr/lib64/python3.13/_pyrepl/reader.py", line 659, in restore
self.console.restore()
~~~~~~~~~~~~~~~~~~~~^^
File "/usr/lib64/python3.13/_pyrepl/unix_console.py", line 380, in restore
signal.signal(signal.SIGWINCH, self.old_sigwinch)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.13/signal.py", line 58, in signal
handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
TypeError: signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object
Follow-up of
https://github.com/juju4/spython/tree/devel-journald/journald (code)
https://github.com/zooba/spython/issues/13
CPython versions tested on:
3.13
Operating systems tested on:
Linux
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先,在 Fedora 41 上使用 Python 3.13.2 重現 ./spython 工作階段,並比較正常運作與 TERM=dumb 時的情況。閱讀 _pyrepl/unix_console.py 和 signal.py 中 traceback 的路徑,重點關注 restore() 和 SIGWINCH 處理常式。完成的標準是:內嵌互動式主控台無需 TERM workaround 即可正常運作,且該行為由適當的回歸測試涵蓋。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- operating-systems
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100