-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
IDLE: adjust Python version in doc url for 3.10+ #28228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: [email protected]', | ||
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) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not guaranteed that the Python version contains exactly 2 dots. This code will not work with versions containing 1 or 3 dots.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See also
Lib/idlelib/editor.py
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give an example where that's not the case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3.2
? Also we can release a micro-bugfix in future, like3.11.2.1
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, TIL that 2.7 and 3.2 were indeed missing the micro version in their initial releases. However:
sys.version_info
includedmicro
equal to0
.platform.python_version
which is specifically documented like this:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. But all other code uses
sys.version_info[:2]
instead of parsingplatform.python_version()
if it needs a 2-component version. I think it is more reliable.