From de28d35c125fd7510ae121a7dc15cd23c6f5e1ab Mon Sep 17 00:00:00 2001 From: Christopher Chavez Date: Fri, 14 Apr 2023 04:55:16 -0500 Subject: [PATCH 1/3] gh-103538: Remove unused TK_AQUA code --- Modules/_tkinter.c | 14 ------------- Modules/tkappinit.c | 50 --------------------------------------------- 2 files changed, 64 deletions(-) diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 385a05932a77ed..4dada0b28f0559 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -3283,20 +3283,6 @@ PyInit__tkinter(void) } PyTclObject_Type = o; -#ifdef TK_AQUA - /* Tk_MacOSXSetupTkNotifier must be called before Tcl's subsystems - * start waking up. Note that Tcl_FindExecutable will do this, this - * code must be above it! The original warning from - * tkMacOSXAppInit.c is copied below. - * - * NB - You have to swap in the Tk Notifier BEFORE you start up the - * Tcl interpreter for now. It probably should work to do this - * in the other order, but for now it doesn't seem to. - * - */ - Tk_MacOSXSetupTkNotifier(); -#endif - /* This helps the dynamic loader; in Unicode aware Tcl versions it also helps Tcl find its encodings. */ diff --git a/Modules/tkappinit.c b/Modules/tkappinit.c index 67d6250318c616..4c4081e43a8e3d 100644 --- a/Modules/tkappinit.c +++ b/Modules/tkappinit.c @@ -23,54 +23,9 @@ Tcl_AppInit(Tcl_Interp *interp) { const char *_tkinter_skip_tk_init; -#ifdef TK_AQUA -#ifndef MAX_PATH_LEN -#define MAX_PATH_LEN 1024 -#endif - char tclLibPath[MAX_PATH_LEN], tkLibPath[MAX_PATH_LEN]; - Tcl_Obj* pathPtr; - - /* pre- Tcl_Init code copied from tkMacOSXAppInit.c */ - Tk_MacOSXOpenBundleResources (interp, "com.tcltk.tcllibrary", - tclLibPath, MAX_PATH_LEN, 0); - - if (tclLibPath[0] != '\0') { - Tcl_SetVar(interp, "tcl_library", tclLibPath, TCL_GLOBAL_ONLY); - Tcl_SetVar(interp, "tclDefaultLibrary", tclLibPath, TCL_GLOBAL_ONLY); - Tcl_SetVar(interp, "tcl_pkgPath", tclLibPath, TCL_GLOBAL_ONLY); - } - - if (tclLibPath[0] != '\0') { - Tcl_SetVar(interp, "tcl_library", tclLibPath, TCL_GLOBAL_ONLY); - Tcl_SetVar(interp, "tclDefaultLibrary", tclLibPath, TCL_GLOBAL_ONLY); - Tcl_SetVar(interp, "tcl_pkgPath", tclLibPath, TCL_GLOBAL_ONLY); - } -#endif if (Tcl_Init (interp) == TCL_ERROR) return TCL_ERROR; -#ifdef TK_AQUA - /* pre- Tk_Init code copied from tkMacOSXAppInit.c */ - Tk_MacOSXOpenBundleResources (interp, "com.tcltk.tklibrary", - tkLibPath, MAX_PATH_LEN, 1); - - if (tclLibPath[0] != '\0') { - pathPtr = Tcl_NewStringObj(tclLibPath, -1); - } else { - Tcl_Obj *pathPtr = TclGetLibraryPath(); - } - - if (tkLibPath[0] != '\0') { - Tcl_Obj *objPtr; - - Tcl_SetVar(interp, "tk_library", tkLibPath, TCL_GLOBAL_ONLY); - objPtr = Tcl_NewStringObj(tkLibPath, -1); - Tcl_ListObjAppendElement(NULL, pathPtr, objPtr); - } - - TclSetLibraryPath(pathPtr); -#endif - #ifdef WITH_XXX /* Initialize modules that don't require Tk */ #endif @@ -88,11 +43,6 @@ Tcl_AppInit(Tcl_Interp *interp) Tk_MainWindow(interp); -#ifdef TK_AQUA - TkMacOSXInitAppleEvents(interp); - TkMacOSXInitMenus(interp); -#endif - #ifdef WITH_PIL /* 0.2b5 and later -- not yet released as of May 14 */ { extern void TkImaging_Init(Tcl_Interp *); From d51eec1d7bd424ccd3e7c3fb67bf381cf54d8866 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Fri, 14 Apr 2023 21:12:33 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Library/2023-04-14-21-12-32.gh-issue-103538.M4FK_v.rst | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2023-04-14-21-12-32.gh-issue-103538.M4FK_v.rst diff --git a/Misc/NEWS.d/next/Library/2023-04-14-21-12-32.gh-issue-103538.M4FK_v.rst b/Misc/NEWS.d/next/Library/2023-04-14-21-12-32.gh-issue-103538.M4FK_v.rst new file mode 100644 index 00000000000000..9e21d5723df424 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-04-14-21-12-32.gh-issue-103538.M4FK_v.rst @@ -0,0 +1,4 @@ +Remove code defined by the ``TK_AQUA`` macro, because: + +#. it reportedly was only needed for Tk 8.4.7 or earlier (see gh-issue-49370), whereas Tkinter has since required 8.5.12 (see gh-issue-91152); and +#. it seems to have been unused since it was committed (in gh-issue-35685), as neither CPython nor Tcl/Tk ever defined the ``TK_AQUA`` macro anywhere. From bd45b97565d5fc36b90cc5badb06e5cad1432f7c Mon Sep 17 00:00:00 2001 From: Zachary Ware Date: Wed, 10 May 2023 13:21:41 -0500 Subject: [PATCH 3/3] Update Misc/NEWS.d/next/Library/2023-04-14-21-12-32.gh-issue-103538.M4FK_v.rst --- .../Library/2023-04-14-21-12-32.gh-issue-103538.M4FK_v.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Misc/NEWS.d/next/Library/2023-04-14-21-12-32.gh-issue-103538.M4FK_v.rst b/Misc/NEWS.d/next/Library/2023-04-14-21-12-32.gh-issue-103538.M4FK_v.rst index 9e21d5723df424..32788307d6f33b 100644 --- a/Misc/NEWS.d/next/Library/2023-04-14-21-12-32.gh-issue-103538.M4FK_v.rst +++ b/Misc/NEWS.d/next/Library/2023-04-14-21-12-32.gh-issue-103538.M4FK_v.rst @@ -1,4 +1,3 @@ -Remove code defined by the ``TK_AQUA`` macro, because: - -#. it reportedly was only needed for Tk 8.4.7 or earlier (see gh-issue-49370), whereas Tkinter has since required 8.5.12 (see gh-issue-91152); and -#. it seems to have been unused since it was committed (in gh-issue-35685), as neither CPython nor Tcl/Tk ever defined the ``TK_AQUA`` macro anywhere. +Remove ``_tkinter`` module code guarded by definition of the ``TK_AQUA`` macro +which was only needed for Tk 8.4.7 or earlier and was never actually defined by +any build system or documented for manual use.