Skip to content

check_extension_modules.py hangs build due to SIGTTIN #148240

@haampie

Description

@haampie

Bug description:

When building Python in a zsh terminal on macOS with stdin a tty (edit: and 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 2c8f26c

Operating systems tested on:

macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-macbuildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions