]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-96491: Deduplicate version in IDLE shell title (GH-139841) (#139932)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 11 Oct 2025 02:00:21 +0000 (04:00 +0200)
committerGitHub <noreply@github.com>
Sat, 11 Oct 2025 02:00:21 +0000 (02:00 +0000)
gh-96491: Deduplicate version in IDLE shell title (GH-139841)

Saving to a file added both the filename and repeated the version.
---------
(cherry picked from commit d4e5802588db3459f04d4b8013cc571a8988e203)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Lib/idlelib/CREDITS.txt
Lib/idlelib/editor.py
Lib/idlelib/idle_test/test_outwin.py
Lib/idlelib/pyshell.py
Misc/NEWS.d/next/IDLE/2025-10-09-12-53-47.gh-issue-96491.4YKxvy.rst [new file with mode: 0644]

index bea3ba7c20de22ea6e40f3a79fa49aea3e40ad0d..1b853e8cc1c4621695cc37a32a40eaae2396c62b 100644 (file)
@@ -37,6 +37,7 @@ Major contributors since 2005:
 - 2014: Saimadhav Heblikar
 - 2015: Mark Roseman
 - 2017: Louie Lu, Cheryl Sabella, and Serhiy Storchaka
+- 2025: Stan Ulbrych
 
 For additional details refer to NEWS.txt and Changelog.
 
index b4d6d25871bcf4f3b35bba0439ce169efc74161a..83112d85575e478d538802221f02def952b78102 100644 (file)
@@ -33,7 +33,6 @@ from idlelib.help import _get_dochome
 
 # The default tab setting for a Text widget, in average-width characters.
 TK_TABWIDTH_DEFAULT = 8
-_py_version = ' (%s)' % platform.python_version()
 darwin = sys.platform == 'darwin'
 
 def _sphinx_version():
@@ -1008,12 +1007,16 @@ class EditorWindow:
     def saved_change_hook(self):
         short = self.short_title()
         long = self.long_title()
+        _py_version = ' (%s)' % platform.python_version()
         if short and long and not macosx.isCocoaTk():
             # Don't use both values on macOS because
             # that doesn't match platform conventions.
             title = short + " - " + long + _py_version
         elif short:
-            title = short
+            if short == "IDLE Shell":
+                title = short + " " +  platform.python_version()
+            else:
+                title = short + _py_version
         elif long:
             title = long
         else:
index 81f4aad7e95e9557f0eb991b52f97f8e92d5011f..0f13363f84f36107283d074ba7ed208f288e5eea 100644 (file)
@@ -1,6 +1,7 @@
 "Test outwin, coverage 76%."
 
 from idlelib import outwin
+import platform
 import sys
 import unittest
 from test.support import requires
@@ -41,7 +42,7 @@ class OutputWindowTest(unittest.TestCase):
         self.assertFalse(w.ispythonsource(__file__))
 
     def test_window_title(self):
-        self.assertEqual(self.window.top.title(), 'Output')
+        self.assertEqual(self.window.top.title(), 'Output' + ' (%s)' % platform.python_version())
 
     def test_maybesave(self):
         w = self.window
index 60b63d58cdd8a35b74f24cbf4b9e7a109c8c749d..f027f82d8491ae58af4ee8ea145c1f70044c1fcc 100755 (executable)
@@ -22,7 +22,6 @@ import itertools
 import linecache
 import os
 import os.path
-from platform import python_version
 import re
 import socket
 import subprocess
@@ -841,7 +840,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
 class PyShell(OutputWindow):
     from idlelib.squeezer import Squeezer
 
-    shell_title = "IDLE Shell " + python_version()
+    shell_title = "IDLE Shell"
 
     # Override classes
     ColorDelegator = ModifiedColorDelegator
diff --git a/Misc/NEWS.d/next/IDLE/2025-10-09-12-53-47.gh-issue-96491.4YKxvy.rst b/Misc/NEWS.d/next/IDLE/2025-10-09-12-53-47.gh-issue-96491.4YKxvy.rst
new file mode 100644 (file)
index 0000000..beb6ef5
--- /dev/null
@@ -0,0 +1 @@
+Deduplicate version number in IDLE shell title bar after saving to a file.