]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-112936: Fix IDLE: no Shell menu item in single-process mode (GH-126598)
authorZhikang Yan <2951256653@qq.com>
Fri, 2 May 2025 17:03:32 +0000 (01:03 +0800)
committerGitHub <noreply@github.com>
Fri, 2 May 2025 17:03:32 +0000 (20:03 +0300)
Lib/idlelib/pyshell.py
Misc/NEWS.d/next/IDLE/2024-11-08-18-07-13.gh-issue-112936.1Q2RcP.rst [new file with mode: 0644]

index 295d06e4a5f017803fa89b904e71d93c9addaf2c..60b63d58cdd8a35b74f24cbf4b9e7a109c8c749d 100755 (executable)
@@ -877,10 +877,9 @@ class PyShell(OutputWindow):
     from idlelib.sidebar import ShellSidebar
 
     def __init__(self, flist=None):
-        if use_subprocess:
-            ms = self.menu_specs
-            if ms[2][0] != "shell":
-                ms.insert(2, ("shell", "She_ll"))
+        ms = self.menu_specs
+        if ms[2][0] != "shell":
+            ms.insert(2, ("shell", "She_ll"))
         self.interp = ModifiedInterpreter(self)
         if flist is None:
             root = Tk()
@@ -954,6 +953,11 @@ class PyShell(OutputWindow):
         self.text.insert = self.per.top.insert
         self.per.insertfilter(UserInputTaggingDelegator())
 
+        if not use_subprocess:
+            # Menu options "View Last Restart" and "Restart Shell" are disabled
+            self.update_menu_state("shell", 0, "disabled")
+            self.update_menu_state("shell", 1, "disabled")
+
     def ResetFont(self):
         super().ResetFont()
 
diff --git a/Misc/NEWS.d/next/IDLE/2024-11-08-18-07-13.gh-issue-112936.1Q2RcP.rst b/Misc/NEWS.d/next/IDLE/2024-11-08-18-07-13.gh-issue-112936.1Q2RcP.rst
new file mode 100644 (file)
index 0000000..8536e38
--- /dev/null
@@ -0,0 +1 @@
+fix IDLE: no Shell menu item in single-process mode.