mirror of
https://github.com/python/cpython.git
synced 2025-10-03 05:35:59 +00:00
gh-97527: IDLE - fix buggy macosx patch (GH-98313)
GH-97530 fixed IDLE tests possibly crashing on a Mac without a GUI.
But it resulted in IDLE not starting in 3.10.8, 3.12.0a1, and
Microsoft Python 3.10.2288.0 when test/* is not installed.
After this patch, test.* is only imported when testing on Mac.
(cherry picked from commit 35fa5d5e7f
)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This commit is contained in:
parent
b5874fae0a
commit
21fbf1631d
3 changed files with 34 additions and 16 deletions
|
@ -4,6 +4,11 @@ Released on 2022-10-03
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
|
|
||||||
|
gh-97527: Fix a bug in the previous bugfix that caused IDLE to not
|
||||||
|
start when run with 3.10.8, 3.12.0a1, and at least Microsoft Python
|
||||||
|
3.10.2288.0 installed without the Lib/test package. 3.11.0 was never
|
||||||
|
affected.
|
||||||
|
|
||||||
gh-65802: Document handling of extensions in Save As dialogs.
|
gh-65802: Document handling of extensions in Save As dialogs.
|
||||||
|
|
||||||
gh-95191: Include prompts when saving Shell (interactive input/output).
|
gh-95191: Include prompts when saving Shell (interactive input/output).
|
||||||
|
|
|
@ -4,7 +4,6 @@ A number of functions that enhance IDLE on macOS.
|
||||||
from os.path import expanduser
|
from os.path import expanduser
|
||||||
import plistlib
|
import plistlib
|
||||||
from sys import platform # Used in _init_tk_type, changed by test.
|
from sys import platform # Used in _init_tk_type, changed by test.
|
||||||
from test.support import requires, ResourceDenied
|
|
||||||
|
|
||||||
import tkinter
|
import tkinter
|
||||||
|
|
||||||
|
@ -16,27 +15,38 @@ _tk_type = None
|
||||||
|
|
||||||
def _init_tk_type():
|
def _init_tk_type():
|
||||||
""" Initialize _tk_type for isXyzTk functions.
|
""" Initialize _tk_type for isXyzTk functions.
|
||||||
|
|
||||||
|
This function is only called once, when _tk_type is still None.
|
||||||
"""
|
"""
|
||||||
global _tk_type
|
global _tk_type
|
||||||
if platform == 'darwin':
|
if platform == 'darwin':
|
||||||
try:
|
|
||||||
requires('gui')
|
# When running IDLE, GUI is present, test/* may not be.
|
||||||
except ResourceDenied: # Possible when testing.
|
# When running tests, test/* is present, GUI may not be.
|
||||||
_tk_type = "cocoa" # Newest and most common.
|
# If not, guess most common. Does not matter for testing.
|
||||||
else:
|
from idlelib.__init__ import testing
|
||||||
root = tkinter.Tk()
|
if testing:
|
||||||
ws = root.tk.call('tk', 'windowingsystem')
|
from test.support import requires, ResourceDenied
|
||||||
if 'x11' in ws:
|
try:
|
||||||
_tk_type = "xquartz"
|
requires('gui')
|
||||||
elif 'aqua' not in ws:
|
except ResourceDenied:
|
||||||
_tk_type = "other"
|
|
||||||
elif 'AppKit' in root.tk.call('winfo', 'server', '.'):
|
|
||||||
_tk_type = "cocoa"
|
_tk_type = "cocoa"
|
||||||
else:
|
return
|
||||||
_tk_type = "carbon"
|
|
||||||
root.destroy()
|
root = tkinter.Tk()
|
||||||
|
ws = root.tk.call('tk', 'windowingsystem')
|
||||||
|
if 'x11' in ws:
|
||||||
|
_tk_type = "xquartz"
|
||||||
|
elif 'aqua' not in ws:
|
||||||
|
_tk_type = "other"
|
||||||
|
elif 'AppKit' in root.tk.call('winfo', 'server', '.'):
|
||||||
|
_tk_type = "cocoa"
|
||||||
|
else:
|
||||||
|
_tk_type = "carbon"
|
||||||
|
root.destroy()
|
||||||
else:
|
else:
|
||||||
_tk_type = "other"
|
_tk_type = "other"
|
||||||
|
return
|
||||||
|
|
||||||
def isAquaTk():
|
def isAquaTk():
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
Fix a bug in the previous bugfix that caused IDLE to not start when run with
|
||||||
|
3.10.8, 3.12.0a1, and at least Microsoft Python 3.10.2288.0 installed
|
||||||
|
without the Lib/test package. 3.11.0 was never affected.
|
Loading…
Add table
Add a link
Reference in a new issue