[Python-checkins] IDLE: adjust Python version in doc url for 3.10+ (GH-28228) (GH-28282)

terryjreedy webhook-mailer at python.org
Fri Sep 10 18:23:03 EDT 2021


https://github.com/python/cpython/commit/1b02e29fb2751ccd14fab6c12f0f79940e3ce531
commit: 1b02e29fb2751ccd14fab6c12f0f79940e3ce531
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: terryjreedy <tjreedy at udel.edu>
date: 2021-09-10T18:22:54-04:00
summary:

IDLE: adjust Python version in doc url for 3.10+ (GH-28228) (GH-28282)

Expression 'python_version()[:3]' truncated '3.10.0' to '3.1' instead of '3.10'.

Co-authored-by: Terry Jan Reedy <tjreedy at udel.edu>
(cherry picked from commit b74c819fab86bedc9b962ea42cfb9b5893fd2dda)

Co-authored-by: giovanniwijaya <16949408+giovanniwijaya at users.noreply.github.com>

files:
M Lib/idlelib/help_about.py

diff --git a/Lib/idlelib/help_about.py b/Lib/idlelib/help_about.py
index 64b13ac2abb3b..019aacbd0faa2 100644
--- a/Lib/idlelib/help_about.py
+++ b/Lib/idlelib/help_about.py
@@ -10,6 +10,8 @@
 
 from idlelib import textview
 
+version = python_version()
+
 
 def build_bits():
     "Return bits for platform."
@@ -42,7 +44,7 @@ def __init__(self, parent, title=None, *, _htest=False, _utest=False):
         self.create_widgets()
         self.resizable(height=False, width=False)
         self.title(title or
-                   f'About IDLE {python_version()} ({build_bits()} bit)')
+                   f'About IDLE {version} ({build_bits()} bit)')
         self.transient(parent)
         self.grab_set()
         self.protocol("WM_DELETE_WINDOW", self.ok)
@@ -88,8 +90,8 @@ def create_widgets(self):
         email = Label(frame_background, text='email:  idle-dev at python.org',
                       justify=LEFT, fg=self.fg, bg=self.bg)
         email.grid(row=6, column=0, columnspan=2, sticky=W, padx=10, pady=0)
-        docs = Label(frame_background, text='https://docs.python.org/' +
-                     python_version()[:3] + '/library/idle.html',
+        docs = Label(frame_background, text="https://docs.python.org/"
+                     f"{version[:version.rindex('.')]}/library/idle.html",
                      justify=LEFT, fg=self.fg, bg=self.bg)
         docs.grid(row=7, column=0, columnspan=2, sticky=W, padx=10, pady=0)
 
@@ -98,7 +100,7 @@ def create_widgets(self):
                                          columnspan=3, padx=5, pady=5)
 
         pyver = Label(frame_background,
-                      text='Python version:  ' + python_version(),
+                      text='Python version:  ' + version,
                       fg=self.fg, bg=self.bg)
         pyver.grid(row=9, column=0, sticky=W, padx=10, pady=0)
         tkver = Label(frame_background, text='Tk version:  ' + tk_patchlevel,
@@ -124,7 +126,7 @@ def create_widgets(self):
                                          columnspan=3, padx=5, pady=5)
 
         idlever = Label(frame_background,
-                        text='IDLE version:   ' + python_version(),
+                        text='IDLE version:   ' + version,
                         fg=self.fg, bg=self.bg)
         idlever.grid(row=12, column=0, sticky=W, padx=10, pady=0)
         idle_buttons = Frame(frame_background, bg=self.bg)



More information about the Python-checkins mailing list