Skip to content

[3.15] gh-157672: Keep Python's signal handlers when Tk is initialized on macOS (GH-157673) - #157987

Open
serhiy-storchaka wants to merge 1 commit into
python:3.15from
serhiy-storchaka:bp-157672-3.15
Open

serhiy-storchaka wants to merge 1 commit into
python:3.15from
serhiy-storchaka:bp-157672-3.15

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Tk on macOS replaces the SIGINT, SIGHUP and SIGTERM handlers with its own, which exits the process, so Ctrl-C terminated a tkinter program instead of raising KeyboardInterrupt. Save the handlers installed by Python before Tk_Init() and restore them after it.

This affects Tk 8.6.11 to 8.6.18 and 9.0 to 9.0.4. Tk itself is fixed in 8.6.19 and 9.0.5.

(cherry picked from commit 4532b36)

… on macOS (pythonGH-157673)

Tk on macOS replaces the SIGINT, SIGHUP and SIGTERM handlers with its
own, which exits the process, so Ctrl-C terminated a tkinter program
instead of raising KeyboardInterrupt.  Save the handlers installed by
Python before Tk_Init() and restore them after it.

This affects Tk 8.6.11 to 8.6.18 and 9.0 to 9.0.4.  Tk itself is fixed
in 8.6.19 and 9.0.5.

(cherry picked from commit 4532b36)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant