From 645efb9dfb289ba4fd532c395075c4e4a8406eec Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Tue, 13 Feb 2024 18:02:15 -0500 Subject: [PATCH] gh-115436: Avoid falling back to deprecated Apple-supplied Tcl/Tk 8.5 on macOS --- .../2024-02-13-19-42-26.gh-issue-115436.pwFBjU.rst | 7 +++++++ setup.py | 13 ++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 Misc/NEWS.d/next/macOS/2024-02-13-19-42-26.gh-issue-115436.pwFBjU.rst diff --git a/Misc/NEWS.d/next/macOS/2024-02-13-19-42-26.gh-issue-115436.pwFBjU.rst b/Misc/NEWS.d/next/macOS/2024-02-13-19-42-26.gh-issue-115436.pwFBjU.rst new file mode 100644 index 00000000000000..576a977857648e --- /dev/null +++ b/Misc/NEWS.d/next/macOS/2024-02-13-19-42-26.gh-issue-115436.pwFBjU.rst @@ -0,0 +1,7 @@ +Avoid falling back to the deprecated Apple-supplied system Tcl/Tk 8.5 on +macOS builds as this version is known to have many critical problems and +causes Python test suite failures. This last-ditch fallback behavior was +removed in Python 3.11 but is still causing problems for users and Python +release testing for older security-fix-only branches like this one. With +this change, building of `_tkinter` on macOS will be skipped if no other +versions of Tcl/Tk can be found. diff --git a/setup.py b/setup.py index 0bec170d3f2448..6aad5aa98b1555 100644 --- a/setup.py +++ b/setup.py @@ -1867,8 +1867,7 @@ def detect_tkinter_darwin(self): # Tcl and Tk frameworks installed in /Library/Frameworks. # 2. Build and link using a user-specified macOS SDK so that the # built Python can be exported to other systems. In this case, - # search only the SDK's /Library/Frameworks (normally empty) - # and /System/Library/Frameworks. + # search only the SDK's /Library/Frameworks (normally empty). # # Any other use case should be able to be handled explicitly by # using the options described above in detect_tkinter_explicitly(). @@ -1888,6 +1887,10 @@ def detect_tkinter_darwin(self): # all possible by installing a newer version of Tcl and Tk in # /Library/Frameworks before building Python without # an explicit SDK or by configuring build arguments explicitly. + # CHANGED: we no longer fall back to searching for the + # Apple-supplied Tcl and Tk 8.5 in /System/Library/Frameworks + # as their use causes too many problems for users. It seems + # better to just skip building _tkinter at all in that case. from os.path import join, exists @@ -1898,17 +1901,13 @@ def detect_tkinter_darwin(self): # Only search there. framework_dirs = [ join(sysroot, 'Library', 'Frameworks'), - join(sysroot, 'System', 'Library', 'Frameworks'), ] else: # Use case #1: no explicit SDK selected. # Search the local system-wide /Library/Frameworks, - # not the one in the default SDK, otherwise fall back to - # /System/Library/Frameworks whose header files may be in - # the default SDK or, on older systems, actually installed. + # not the one in the default SDK. framework_dirs = [ join('/', 'Library', 'Frameworks'), - join(sysroot, 'System', 'Library', 'Frameworks'), ] # Find the directory that contains the Tcl.framework and