Skip to content

IDLE on macOS 27 hangs when a menu command opens a dialog #158053

Description

Bug report

Bug description:

IDLE on macOS 27 hangs (beach ball, Force Quit) when a menu command opens a dialog or waits on the shell socket. The process is not idle-locked by user code. The main thread is stuck inside the macOS menu-bar callback.

What happens

macOS 27.0 (build 26A428) delivers menu clicks through MenuBarClientCore 1.0 while Tk is already inside its event loop. Tk runs the menu command on that stack. If the command opens a modal dialog, or enters another Tk event loop that blocks in select (IDLE waiting on the Run/Shell subprocess), the menu-bar call never returns. The window stops redrawing. Activity Monitor shows the process as not responding. Force Quit is the only way out. Unsaved editor text is lost.

This did not happen on macOS Tahoe 26.6.2. It started after the update to macOS 27 (this machine: 2026-09-10). The Python.org installers were not changed at that time.

Reproduced with

Official python.org IDLE.app, native arm64, Rosetta not involved.

  • Python 3.14.7, Tk 9.0.4. Hang sample: main thread in MenuBarClientCore â�� Tk â�� nested event loop â�� select / sock_accept.
  • Python 3.13.14, Tk 8.6.18. Same stack from IDLE > Settings (::tk::mac::ShowPreferences). Settings is enough. No user script required.

Reliable steps:

  1. Install the python.org macOS package for 3.13 or 3.14.
  2. Launch IDLE.app.
  3. Click IDLE > Settings in the menu bar.
  4. Beach ball. The Settings window does not finish opening. Force Quit.

Save As and Run Module can take the same path, because they open a dialog or wait on the shell socket before the menu callback returns.

Expected

The menu action returns, then IDLE opens Settings (or the save dialog, or runs the module). The window stays responsive.

Cause

The hang is the nested event loop inside the menu-bar callback, not IDLE's editor code and not the user's program. A menu command that returns immediately, then does the real work on the next Tk turn, does not hang. Verified on both 3.13.14 and 3.14.7: after that deferral, IDLE > Settings opens and the process stays in Tk_mainloop.

Suggested fix

On macOS, IDLE should not run dialog or shell work inside the menu-bar callback. Schedule those commands with after idle (and the same for ::tk::mac::ShowPreferences, ShowHelp, Quit, and the standard About panel) so MenuBarClientCore's call returns before Tk nests another loop.

This should live in idlelib (macosx.py or the menu setup), not as a per-user extension. Other Tk apps on macOS 27 have the same OS interaction; Apple is being asked, separately, to make the menu bar tolerate a nested run loop. IDLE still needs the deferral so current macOS 27 users are not stuck.

Environment

  • macOS 27.0 (26A428), MenuBarClientCore 1.0 (97.0.9.402)
  • Previous OS, where this did not happen: macOS Tahoe 26.6.2
  • CPython 3.13.14 (Tk 8.6) and 3.14.7 (Tk 9.0), both from python.org macOS installers
  • Native arm64

CPython versions tested on:

3.14, 3.13

Operating systems tested on:

macOS

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixes3.15pre-release feature fixes, bugs and security fixes3.16new features, bugs and security fixesOS-mactopic-IDLEtype-bugAn unexpected behavior, bug, or error

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions