Skip to content

[3.14] gh-153480: Stop IDLE crashing when a file open in the editor is deleted (GH-153481) - #158262

Merged
terryjreedy merged 1 commit into
python:3.14from
miss-islington:backport-6af40a6-3.14
Sep 27, 2026
Merged

terryjreedy merged 1 commit into
python:3.14from
miss-islington:backport-6af40a6-3.14

Conversation

@miss-islington

@miss-islington miss-islington commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

EditorWindow.focus_in_event calls last_mtime on every event,
which passed the open file path to os.path.getmtime with no guard. When
another program deleted or renamed the file, refocusing the IDLE window
let a FileNotFoundError escape the Tk event handler. last_mtime now
returns the last known mtime when the path is inaccessible, so refocusing
no longer raises and does not prompt to reload a file that is gone.
See PR discussion for more.


(cherry picked from commit 6af40a6)

Co-authored-by: tonghuaroot (童话) tonghuaroot@gmail.com
Co-authored-by: Serhiy Storchaka storchaka@gmail.com

… deleted (pythonGH-153481)

EditorWindow.focus_in_event calls last_mtime on every <FocusIn> event,
which passed the open file path to os.path.getmtime with no guard. When
another program deleted or renamed the file, refocusing the IDLE window
let a FileNotFoundError escape the Tk event handler. last_mtime now
returns the last known mtime when the path is inaccessible, so refocusing
no longer raises and does not prompt to reload a file that is gone.
See PR discussion for more.

---------
(cherry picked from commit 6af40a6)

Co-authored-by: tonghuaroot (童话) <tonghuaroot@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@terryjreedy
terryjreedy enabled auto-merge (squash) September 27, 2026 01:14
@terryjreedy
terryjreedy merged commit cbc7753 into python:3.14 Sep 27, 2026
51 checks passed
@miss-islington
miss-islington deleted the backport-6af40a6-3.14 branch September 27, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants