From e6b18c90b9e5cfbfac55f33f05d39f16731401a5 Mon Sep 17 00:00:00 2001 From: Muhamed Fazal PS Date: Sat, 11 Jul 2026 00:37:39 +0530 Subject: [PATCH 1/5] gh-153506: Fix IDLE crash on non-iterable __all__ When a module has __all__ set to a non-iterable value (like None), pressing Tab for module-name completion raised an uncaught TypeError. Now checks hasattr(__all__, '__iter__') before calling sorted(), falling back to the standard private-name filtering. --- Lib/idlelib/autocomplete.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/idlelib/autocomplete.py b/Lib/idlelib/autocomplete.py index 032d31225315fb..e25e0fe611662b 100644 --- a/Lib/idlelib/autocomplete.py +++ b/Lib/idlelib/autocomplete.py @@ -186,7 +186,7 @@ def fetch_completions(self, what, mode): bigl.extend(completion_kwds) bigl.sort() if "__all__" in bigl: - smalll = sorted(eval("__all__", namespace)) + all_val = eval("__all__", namespace); smalll = sorted(all_val) if hasattr(all_val, "__iter__") else [s for s in bigl if s[:1] != "_"] else: smalll = [s for s in bigl if s[:1] != '_'] else: @@ -195,7 +195,7 @@ def fetch_completions(self, what, mode): bigl = dir(entity) bigl.sort() if "__all__" in bigl: - smalll = sorted(entity.__all__) + all_val = entity.__all__; smalll = sorted(all_val) if hasattr(all_val, "__iter__") else [s for s in bigl if s[:1] != "_"] else: smalll = [s for s in bigl if s[:1] != '_'] except: From 55c1d234ae0e7ebdd24eddd35c0639c5c4803495 Mon Sep 17 00:00:00 2001 From: Muhamed Fazal PS Date: Sat, 11 Jul 2026 00:48:10 +0530 Subject: [PATCH 2/5] Add NEWS entry for gh-153506 --- Misc/News.d/next/IDLE/153506.rst | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Misc/News.d/next/IDLE/153506.rst diff --git a/Misc/News.d/next/IDLE/153506.rst b/Misc/News.d/next/IDLE/153506.rst new file mode 100644 index 00000000000000..90b9d7716b45de --- /dev/null +++ b/Misc/News.d/next/IDLE/153506.rst @@ -0,0 +1,3 @@ +Fix IDLE shell crash when Tab-completing in a module with a non-iterable +``__all__`` attribute (e.g. ``__all__ = None``). The shell now falls back +to standard completion instead of raising :exc:`TypeError`. From 32492663fdaaef96891315025e16b3093c74360b Mon Sep 17 00:00:00 2001 From: Muhamed Fazal PS Date: Sat, 11 Jul 2026 01:39:21 +0530 Subject: [PATCH 3/5] Fix NEWS entry format for gh-153506 --- ...{153506.rst => 2026-07-11-00-00-00.gh-issue-153506.xYzAbC.rst} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Misc/News.d/next/IDLE/{153506.rst => 2026-07-11-00-00-00.gh-issue-153506.xYzAbC.rst} (100%) diff --git a/Misc/News.d/next/IDLE/153506.rst b/Misc/News.d/next/IDLE/2026-07-11-00-00-00.gh-issue-153506.xYzAbC.rst similarity index 100% rename from Misc/News.d/next/IDLE/153506.rst rename to Misc/News.d/next/IDLE/2026-07-11-00-00-00.gh-issue-153506.xYzAbC.rst From 1da2d3ef67c8657a981accc439c1b9e7b678fef9 Mon Sep 17 00:00:00 2001 From: Muhamed Fazal PS Date: Sat, 11 Jul 2026 09:20:09 +0530 Subject: [PATCH 4/5] Fix lint: break semicolons into separate lines --- Lib/idlelib/autocomplete.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Lib/idlelib/autocomplete.py b/Lib/idlelib/autocomplete.py index e25e0fe611662b..b07e10ac24e46b 100644 --- a/Lib/idlelib/autocomplete.py +++ b/Lib/idlelib/autocomplete.py @@ -186,7 +186,8 @@ def fetch_completions(self, what, mode): bigl.extend(completion_kwds) bigl.sort() if "__all__" in bigl: - all_val = eval("__all__", namespace); smalll = sorted(all_val) if hasattr(all_val, "__iter__") else [s for s in bigl if s[:1] != "_"] + all_val = eval("__all__", namespace) + smalll = sorted(all_val) if hasattr(all_val, "__iter__") else [s for s in bigl if s[:1] != "_"] else: smalll = [s for s in bigl if s[:1] != '_'] else: @@ -195,7 +196,8 @@ def fetch_completions(self, what, mode): bigl = dir(entity) bigl.sort() if "__all__" in bigl: - all_val = entity.__all__; smalll = sorted(all_val) if hasattr(all_val, "__iter__") else [s for s in bigl if s[:1] != "_"] + all_val = entity.__all__ + smalll = sorted(all_val) if hasattr(all_val, "__iter__") else [s for s in bigl if s[:1] != "_"] else: smalll = [s for s in bigl if s[:1] != '_'] except: From e12ee43986d8d34304e626460ad9aece951a2a8f Mon Sep 17 00:00:00 2001 From: Muhamed Fazal PS Date: Sat, 11 Jul 2026 11:17:52 +0530 Subject: [PATCH 5/5] Fix NEWS entry path: News.d -> NEWS.d (case-sensitive) --- .../next/IDLE/2026-07-11-00-00-00.gh-issue-153506.xYzAbC.rst | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Misc/{News.d => NEWS.d}/next/IDLE/2026-07-11-00-00-00.gh-issue-153506.xYzAbC.rst (100%) diff --git a/Misc/News.d/next/IDLE/2026-07-11-00-00-00.gh-issue-153506.xYzAbC.rst b/Misc/NEWS.d/next/IDLE/2026-07-11-00-00-00.gh-issue-153506.xYzAbC.rst similarity index 100% rename from Misc/News.d/next/IDLE/2026-07-11-00-00-00.gh-issue-153506.xYzAbC.rst rename to Misc/NEWS.d/next/IDLE/2026-07-11-00-00-00.gh-issue-153506.xYzAbC.rst