Tk Source Code

View Ticket
Login
Ticket UUID: 989b1ccb982dd8979b9af267db7a1ba456f3e1e4
Title: Aqua: Tk should not replace signal handlers installed by an application which embeds Tk.
Type: Patch Version: 9.1
Submitter: marc_culler Created on: 2026-09-21 20:08:58
Subsystem: 99. Other Assigned To: marc_culler
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2026-09-23 08:35:10
Resolution: Fixed Closed By: marc_culler
    Closed on: 2026-09-22 15:40:17
Description:
Currently the Aqua implementation of TkpInit install a signal handler for
SIGINT, SIGHUP and SIGTERM which calls Tcl_Exit(1).  This allows Wish to
exit cleanly when it receives one of those signals.  But it prevents an
application which embeds Tk (such as the Python tkinter module) from
installing its own handler for any of those signals.

Serhiy Storchaka provided a patch in the mac-signal-handlers branch which
alters this behavior to allow an embedding application to provide its own
exit handler.  It only does the replacement if the current handler is the
default handler.  I have reviewed the changes and see no issues.

This ticket is being opened to record that I am merging the mac-signal-handlers
branch into main.
User Comments: serhiy.storchaka added on 2026-09-23 08:35:10:

Merged into core-8-6-branch by commit [c505fe4180].


oehhar added on 2026-09-22 07:03:16:

Thanks, Mac, great !

Serhiy, you may back-port to 8.6 at any time, just do it. I think, the merge to 9.0 was done.

Some of us are more strict in not supporting 8.6 any more, sorry for that.

Take care, Harald


jan.nijtmans added on 2026-09-22 07:02:15:

Now merged to 9.0 as well.


serhiy.storchaka added on 2026-09-21 21:30:35:

Thank you for the review and the merge. There is an existing ticket for this, [f3e96942ed]. Would you consider backporting the change to core-9-0-branch (and 8.6)? Python's Tkinter installs its own SIGINT handler and is affected on all versions.


marc_culler (claiming to be Marc Culler) added on 2026-09-21 20:12:10:
The mac-signal-handlers branch has been merged into main.