python / python/cpython

`check_extension_modules.py` hangs build due to SIGTTIN

未關閉
#148,240 5 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

build OS-mac type-bug
主要語言
Python
星號
77.2k
分支
35.9k
PR 合併指標
PR 指標待擷取

描述

Bug description:

When building Python on macOS with stdin a tty and linking against GNU readline, the build hangs indefinitely.

This is because during the build, python.exe -E check_extension_modules.py is run, which attempts to import the readline module.

At import time of the readline module

  • it runs PyInit_readline
  • which calls get_tty_settings from libreadline.dylib,
  • which ultimately runs an ioctl syscall
  • which immediately suspends the Python process thanks to a SIGTTIN signal.

The Python process isn't supposed to run ioctl syscalls from the background.

I don't know where the fix should go, but I would say it's two separate issues:

  • importing modules during the build sounds like a bad idea due to possible side-effects
  • the readline module running an ioctl call during import risking the process to be suspended when backgrounded sounds bad too.
CPython versions tested on:

3.14, main branch at commit 2c8f26cf5c6ff2398f1e1ed8bfe18e9938bbdebd

Operating systems tested on:

macOS

Linked PRs
  • gh-148279

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從 check_extension_modules.py 和報告中描述的 readline 匯入路徑開始,包括 PyInit_readline 和 get_tty_settings。在 stdin 連接到 tty 的情況下重現 macOS 建置,然後檢查關聯的 PR gh-148279。完成的標準是,在此情境下建置不再掛起或暫停 Python 程序。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
build-system, operating-systems
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
25/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。