diff --git a/cpython-unix/build-cpython.sh b/cpython-unix/build-cpython.sh index 2afeb134..18536375 100755 --- a/cpython-unix/build-cpython.sh +++ b/cpython-unix/build-cpython.sh @@ -281,6 +281,20 @@ if [ -n "${PYTHON_MEETS_MAXIMUM_VERSION_3_10}" ]; then patch -p1 -i ${ROOT}/patch-configure-crypt-no-modify-libs.patch fi +# Backport Tcl/Tk 9.0 support from 3.12 to Python 3.10 and 3.11 +if [ "${PYTHON_MAJMIN_VERSION}" = "3.10" ]; then + # git checkout v3.10.19 + # git cherry-pick 625887e6 27cbeb08 d4680b9e ec139c8f + # git diff v3.10.19 Modules/_tkinter.c > patch-tkinter-backport-tcl-9-310.patch + patch -p1 -i ${ROOT}/patch-tkinter-backport-tcl-9-310.patch +fi +if [ "${PYTHON_MAJMIN_VERSION}" = "3.11" ]; then + # git checkout v3.11.14 + # git cherry-pick 625887e6 27cbeb08 d4680b9e ec139c8f + # git diff v3.11.14 Modules/_tkinter.c > patch-tkinter-backport-tcl-9-311.patch + patch -p1 -i ${ROOT}/patch-tkinter-backport-tcl-9-311.patch +fi + # BOLT instrumented binaries segfault in some test_embed tests for unknown reasons. # On 3.12 (minimum BOLT version), the segfault causes the test harness to # abort and BOLT optimization uses the partial test results. On 3.13, the segfault @@ -1257,11 +1271,11 @@ fi # And prune libraries we never reference. rm -f ${ROOT}/out/python/build/lib/{libdb-6.0,libxcb-*,libX11-xcb}.a -if [ -d "${TOOLS_PATH}/deps/lib/tcl8" ]; then +if [ -d "${TOOLS_PATH}/deps/lib/tk9.0" ]; then # Copy tcl/tk resources needed by tkinter. - mkdir ${ROOT}/out/python/install/lib/tcl + mkdir ${ROOT}/out/python/install/lib/tk9.0 # Keep this list in sync with tcl_library_paths. - for source in ${TOOLS_PATH}/deps/lib/{itcl4.2.4,tcl8,tcl8.6,thread2.8.9,tk8.6}; do + for source in ${TOOLS_PATH}/deps/lib/{itcl4.3.5,thread3.0.4,tk9.0}; do cp -av $source ${ROOT}/out/python/install/lib/ done diff --git a/cpython-unix/build-tcl.sh b/cpython-unix/build-tcl.sh index f619a08c..c41c4403 100755 --- a/cpython-unix/build-tcl.sh +++ b/cpython-unix/build-tcl.sh @@ -22,29 +22,45 @@ pushd tcl${TCL_VERSION} EXTRA_CONFIGURE= if [ -n "${STATIC}" ]; then - if echo "${TARGET_TRIPLE}" | grep -q -- "-unknown-linux-musl"; then - # tcl will use an internal implementation of certain POSIX function when - # cross-compiling. The implementation of strtoul create multiple definitions - # when linked against the static musl libc. Exclude the internal implementation. - EXTRA_CONFIGURE="${EXTRA_CONFIGURE} tcl_cv_strtoul_unbroken=ok" - fi - patch -p1 << 'EOF' diff --git a/unix/Makefile.in b/unix/Makefile.in --- a/unix/Makefile.in +++ b/unix/Makefile.in -@@ -1813,7 +1813,7 @@ configure-packages: +@@ -2062,7 +2062,7 @@ configure-packages: + $$i/configure --with-tcl8 --with-tcl=../.. \ + --with-tclinclude=$(GENERIC_DIR) \ + $(PKG_CFG_ARGS) --libdir=$(PACKAGE_DIR) \ +- --enable-shared; ) || exit $$?; \ ++ --enable-shared=no; ) || exit $$?; \ + fi; \ + mkdir -p $(PKG_DIR)/$$pkg; \ + if [ ! -f $(PKG_DIR)/$$pkg/Makefile ] ; then \ +@@ -2070,7 +2070,7 @@ configure-packages: $$i/configure --with-tcl=../.. \ --with-tclinclude=$(GENERIC_DIR) \ $(PKG_CFG_ARGS) --libdir=$(PACKAGE_DIR) \ -- --enable-shared --enable-threads; ) || exit $$?; \ -+ --enable-shared=no --enable-threads; ) || exit $$?; \ +- --enable-shared; ) || exit $$?; \ ++ --enable-shared=no; ) || exit $$?; \ fi; \ fi; \ fi; \ EOF fi +# Disable the use of fts64_* functions on the 32-bit armv7 platform as these +# functions are not available in glibc 2.17 +if [[ ${TARGET_TRIPLE} = armv7* ]]; then + EXTRA_CONFIGURE="${EXTRA_CONFIGURE} tcl_cv_flag__file_offset_bits=no" +fi + +# musl does not include queue.h +# https://wiki.musl-libc.org/faq#Q:-Why-is-%3Ccode%3Esys/queue.h%3C/code%3E-not-included? +# It is a self contained header file, use a copy from the container. +# https://core.tcl-lang.org/tcl/tktview/3ff2d724d03ba7d6edb8 +if [ "${CC}" = "musl-clang" ]; then + cp /usr/include/$(uname -m)-linux-gnu/sys/queue.h /tools/host/include/sys +fi + # Remove packages we don't care about and can pull in unwanted symbols. rm -rf pkgs/sqlite* pkgs/tdbc* @@ -62,6 +78,7 @@ CFLAGS="${CFLAGS}" CPPFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" ./configure \ --prefix=/tools/deps \ --enable-shared"${STATIC:+=no}" \ --enable-threads \ + --disable-zipfs \ ${EXTRA_CONFIGURE} make -j ${NUM_CPUS} DYLIB_INSTALL_DIR=@rpath diff --git a/cpython-unix/build-tk.sh b/cpython-unix/build-tk.sh index ef13bedd..77d35ec5 100755 --- a/cpython-unix/build-tk.sh +++ b/cpython-unix/build-tk.sh @@ -40,6 +40,7 @@ CFLAGS="${CFLAGS}" CPPFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" ./configure \ --with-tcl=${TOOLS_PATH}/deps/lib \ --enable-shared"${STATIC:+=no}" \ --enable-threads \ + --disable-zipfs \ ${EXTRA_CONFIGURE_FLAGS} # Remove wish, since we don't need it. @@ -48,7 +49,7 @@ if [[ "${PYBUILD_PLATFORM}" = macos* ]]; then else sed_args=(-i) fi -sed "${sed_args[@]}" 's/all: binaries libraries doc/all: libraries/' Makefile +sed "${sed_args[@]}" 's/all: binaries libraries/all: libraries/' Makefile sed "${sed_args[@]}" 's/install-binaries: $(TK_STUB_LIB_FILE) $(TK_LIB_FILE) ${WISH_EXE}/install-binaries: $(TK_STUB_LIB_FILE) $(TK_LIB_FILE)/' Makefile # We are statically linking libX11, and static libraries do not carry diff --git a/cpython-unix/build.py b/cpython-unix/build.py index fd9810c6..43894ecf 100755 --- a/cpython-unix/build.py +++ b/cpython-unix/build.py @@ -913,11 +913,9 @@ def build_cpython( python_info["tcl_library_path"] = "install/lib" python_info["tcl_library_paths"] = [ - "itcl4.2.4", - "tcl8", - "tcl8.6", - "thread2.8.7", - "tk8.6", + "itcl4.3.5", + "thread3.0.4", + "tk9.0", ] if "-apple" in target_triple: diff --git a/cpython-unix/extension-modules.yml b/cpython-unix/extension-modules.yml index 1fb0860d..1a57c461 100644 --- a/cpython-unix/extension-modules.yml +++ b/cpython-unix/extension-modules.yml @@ -664,8 +664,8 @@ _tkinter: - include/X11 build-mode: shared links: - - tcl8.6 - - tk8.6 + - tcl9.0 + - tcl9tk9.0 links-conditional: - name: X11 targets: diff --git a/cpython-unix/patch-tkinter-backport-tcl-9-310.patch b/cpython-unix/patch-tkinter-backport-tcl-9-310.patch new file mode 100644 index 00000000..85e22687 --- /dev/null +++ b/cpython-unix/patch-tkinter-backport-tcl-9-310.patch @@ -0,0 +1,277 @@ +diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c +index 2a3e65b6c97..8bed45f933d 100644 +--- a/Modules/_tkinter.c ++++ b/Modules/_tkinter.c +@@ -55,9 +55,24 @@ Copyright (C) 1994 Steen Lumholt. + #if TK_HEX_VERSION >= 0x08050208 && TK_HEX_VERSION < 0x08060000 || \ + TK_HEX_VERSION >= 0x08060200 + #define HAVE_LIBTOMMATH ++#ifndef TCL_WITH_EXTERNAL_TOMMATH ++#define TCL_NO_TOMMATH_H ++#endif + #include + #endif + ++#if defined(TCL_WITH_EXTERNAL_TOMMATH) || (TK_HEX_VERSION >= 0x08070000) ++#define USE_DEPRECATED_TOMMATH_API 0 ++#else ++#define USE_DEPRECATED_TOMMATH_API 1 ++#endif ++ ++// As suggested by https://core.tcl-lang.org/tcl/wiki?name=Migrating+C+extensions+to+Tcl+9 ++#ifndef TCL_SIZE_MAX ++typedef int Tcl_Size; ++#define TCL_SIZE_MAX INT_MAX ++#endif ++ + #if !(defined(MS_WINDOWS) || defined(__CYGWIN__)) + #define HAVE_CREATEFILEHANDLER + #endif +@@ -308,6 +323,7 @@ typedef struct { + const Tcl_ObjType *ListType; + const Tcl_ObjType *ProcBodyType; + const Tcl_ObjType *StringType; ++ const Tcl_ObjType *UTF32StringType; + } TkappObject; + + #define Tkapp_Interp(v) (((TkappObject *) (v))->interp) +@@ -488,7 +504,7 @@ unicodeFromTclString(const char *s) + static PyObject * + unicodeFromTclObj(Tcl_Obj *value) + { +- int len; ++ Tcl_Size len; + #if USE_TCL_UNICODE + int byteorder = NATIVE_BYTEORDER; + const Tcl_UniChar *u = Tcl_GetUnicodeFromObj(value, &len); +@@ -655,6 +671,10 @@ class _tkinter.tktimertoken "TkttObject *" "&Tktt_Type_spec" + + /**** Tkapp Object ****/ + ++#if TK_MAJOR_VERSION >= 9 ++int Tcl_AppInit(Tcl_Interp *); ++#endif ++ + #ifndef WITH_APPINIT + int + Tcl_AppInit(Tcl_Interp *interp) +@@ -736,15 +756,41 @@ Tkapp_New(const char *screenName, const char *className, + } + + v->OldBooleanType = Tcl_GetObjType("boolean"); +- v->BooleanType = Tcl_GetObjType("booleanString"); +- v->ByteArrayType = Tcl_GetObjType("bytearray"); ++ { ++ Tcl_Obj *value; ++ int boolValue; ++ ++ /* Tcl 8.5 "booleanString" type is not registered ++ and is renamed to "boolean" in Tcl 9.0. ++ Based on approach suggested at ++ https://core.tcl-lang.org/tcl/info/3bb3bcf2da5b */ ++ value = Tcl_NewStringObj("true", -1); ++ Tcl_GetBooleanFromObj(NULL, value, &boolValue); ++ v->BooleanType = value->typePtr; ++ Tcl_DecrRefCount(value); ++ ++ // "bytearray" type is not registered in Tcl 9.0 ++ value = Tcl_NewByteArrayObj(NULL, 0); ++ v->ByteArrayType = value->typePtr; ++ Tcl_DecrRefCount(value); ++ } + v->DoubleType = Tcl_GetObjType("double"); ++ /* TIP 484 suggests retrieving the "int" type without Tcl_GetObjType("int") ++ since it is no longer registered in Tcl 9.0. But even though Tcl 8.7 ++ only uses the "wideInt" type on platforms with 32-bit long, it still has ++ a registered "int" type, which FromObj() should recognize just in case. */ + v->IntType = Tcl_GetObjType("int"); ++ if (v->IntType == NULL) { ++ Tcl_Obj *value = Tcl_NewIntObj(0); ++ v->IntType = value->typePtr; ++ Tcl_DecrRefCount(value); ++ } + v->WideIntType = Tcl_GetObjType("wideInt"); + v->BignumType = Tcl_GetObjType("bignum"); + v->ListType = Tcl_GetObjType("list"); + v->ProcBodyType = Tcl_GetObjType("procbody"); + v->StringType = Tcl_GetObjType("string"); ++ v->UTF32StringType = Tcl_GetObjType("utf32string"); + + /* Delete the 'exit' command, which can screw things up */ + Tcl_DeleteCommand(v->interp, "exit"); +@@ -1229,20 +1275,33 @@ static PyObject* + fromBignumObj(TkappObject *tkapp, Tcl_Obj *value) + { + mp_int bigValue; ++ mp_err err; ++#if USE_DEPRECATED_TOMMATH_API + unsigned long numBytes; ++#else ++ size_t numBytes; ++#endif + unsigned char *bytes; + PyObject *res; + + if (Tcl_GetBignumFromObj(Tkapp_Interp(tkapp), value, &bigValue) != TCL_OK) + return Tkinter_Error(tkapp); ++#if USE_DEPRECATED_TOMMATH_API + numBytes = mp_unsigned_bin_size(&bigValue); ++#else ++ numBytes = mp_ubin_size(&bigValue); ++#endif + bytes = PyMem_Malloc(numBytes); + if (bytes == NULL) { + mp_clear(&bigValue); + return PyErr_NoMemory(); + } +- if (mp_to_unsigned_bin_n(&bigValue, bytes, +- &numBytes) != MP_OKAY) { ++#if USE_DEPRECATED_TOMMATH_API ++ err = mp_to_unsigned_bin_n(&bigValue, bytes, &numBytes); ++#else ++ err = mp_to_ubin(&bigValue, bytes, numBytes, NULL); ++#endif ++ if (err != MP_OKAY) { + mp_clear(&bigValue); + PyMem_Free(bytes); + return PyErr_NoMemory(); +@@ -1277,7 +1336,7 @@ FromObj(TkappObject *tkapp, Tcl_Obj *value) + } + + if (value->typePtr == tkapp->ByteArrayType) { +- int size; ++ Tcl_Size size; + char *data = (char*)Tcl_GetByteArrayFromObj(value, &size); + return PyBytes_FromStringAndSize(data, size); + } +@@ -1286,14 +1345,6 @@ FromObj(TkappObject *tkapp, Tcl_Obj *value) + return PyFloat_FromDouble(value->internalRep.doubleValue); + } + +- if (value->typePtr == tkapp->IntType) { +- long longValue; +- if (Tcl_GetLongFromObj(interp, value, &longValue) == TCL_OK) +- return PyLong_FromLong(longValue); +- /* If there is an error in the long conversion, +- fall through to wideInt handling. */ +- } +- + if (value->typePtr == tkapp->IntType || + value->typePtr == tkapp->WideIntType) { + result = fromWideIntObj(tkapp, value); +@@ -1313,8 +1364,8 @@ FromObj(TkappObject *tkapp, Tcl_Obj *value) + #endif + + if (value->typePtr == tkapp->ListType) { +- int size; +- int i, status; ++ Tcl_Size i, size; ++ int status; + PyObject *elem; + Tcl_Obj *tcl_elem; + +@@ -1340,23 +1391,12 @@ FromObj(TkappObject *tkapp, Tcl_Obj *value) + return result; + } + +- if (value->typePtr == tkapp->ProcBodyType) { +- /* fall through: return tcl object. */ +- } +- +- if (value->typePtr == tkapp->StringType) { ++ if (value->typePtr == tkapp->StringType || ++ value->typePtr == tkapp->UTF32StringType) ++ { + return unicodeFromTclObj(value); + } + +-#if TK_HEX_VERSION >= 0x08050000 +- if (tkapp->BooleanType == NULL && +- strcmp(value->typePtr->name, "booleanString") == 0) { +- /* booleanString type is not registered in Tcl */ +- tkapp->BooleanType = value->typePtr; +- return fromBoolean(tkapp, value); +- } +-#endif +- + #ifdef HAVE_LIBTOMMATH + if (tkapp->BignumType == NULL && + strcmp(value->typePtr->name, "bignum") == 0) { +@@ -1382,10 +1422,10 @@ typedef struct Tkapp_CallEvent { + Tcl_Condition *done; + } Tkapp_CallEvent; + +-void +-Tkapp_CallDeallocArgs(Tcl_Obj** objv, Tcl_Obj** objStore, int objc) ++static void ++Tkapp_CallDeallocArgs(Tcl_Obj** objv, Tcl_Obj** objStore, Tcl_Size objc) + { +- int i; ++ Tcl_Size i; + for (i = 0; i < objc; i++) + Tcl_DecrRefCount(objv[i]); + if (objv != objStore) +@@ -1396,7 +1436,7 @@ Tkapp_CallDeallocArgs(Tcl_Obj** objv, Tcl_Obj** objStore, int objc) + interpreter thread, which may or may not be the calling thread. */ + + static Tcl_Obj** +-Tkapp_CallArgs(PyObject *args, Tcl_Obj** objStore, int *pobjc) ++Tkapp_CallArgs(PyObject *args, Tcl_Obj** objStore, Tcl_Size *pobjc) + { + Tcl_Obj **objv = objStore; + Py_ssize_t objc = 0, i; +@@ -1444,10 +1484,10 @@ Tkapp_CallArgs(PyObject *args, Tcl_Obj** objStore, int *pobjc) + Tcl_IncrRefCount(objv[i]); + } + } +- *pobjc = (int)objc; ++ *pobjc = (Tcl_Size)objc; + return objv; + finally: +- Tkapp_CallDeallocArgs(objv, objStore, (int)objc); ++ Tkapp_CallDeallocArgs(objv, objStore, (Tcl_Size)objc); + return NULL; + } + +@@ -1490,7 +1530,7 @@ Tkapp_CallProc(Tkapp_CallEvent *e, int flags) + { + Tcl_Obj *objStore[ARGSZ]; + Tcl_Obj **objv; +- int objc; ++ Tcl_Size objc; + int i; + ENTER_PYTHON + objv = Tkapp_CallArgs(e->args, objStore, &objc); +@@ -1541,7 +1581,7 @@ Tkapp_Call(PyObject *selfptr, PyObject *args) + { + Tcl_Obj *objStore[ARGSZ]; + Tcl_Obj **objv = NULL; +- int objc, i; ++ Tcl_Size objc; + PyObject *res = NULL; + TkappObject *self = (TkappObject*)selfptr; + int flags = TCL_EVAL_DIRECT | TCL_EVAL_GLOBAL; +@@ -1587,6 +1627,7 @@ Tkapp_Call(PyObject *selfptr, PyObject *args) + else + { + ++ int i; + objv = Tkapp_CallArgs(args, objStore, &objc); + if (!objv) + return NULL; +@@ -2276,13 +2317,12 @@ _tkinter_tkapp_splitlist(TkappObject *self, PyObject *arg) + /*[clinic end generated code: output=13b51d34386d36fb input=2b2e13351e3c0b53]*/ + { + char *list; +- int argc; ++ Tcl_Size argc, i; + const char **argv; + PyObject *v; +- int i; + + if (PyTclObject_Check(arg)) { +- int objc; ++ Tcl_Size objc; + Tcl_Obj **objv; + if (Tcl_ListObjGetElements(Tkapp_Interp(self), + ((PyTclObject*)arg)->value, diff --git a/cpython-unix/patch-tkinter-backport-tcl-9-311.patch b/cpython-unix/patch-tkinter-backport-tcl-9-311.patch new file mode 100644 index 00000000..819948d9 --- /dev/null +++ b/cpython-unix/patch-tkinter-backport-tcl-9-311.patch @@ -0,0 +1,235 @@ +diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c +index 005036d3ff2..2bc963a4025 100644 +--- a/Modules/_tkinter.c ++++ b/Modules/_tkinter.c +@@ -58,6 +58,9 @@ Copyright (C) 1994 Steen Lumholt. + #error "Tk older than 8.5.12 not supported" + #endif + ++#ifndef TCL_WITH_EXTERNAL_TOMMATH ++#define TCL_NO_TOMMATH_H ++#endif + #include + + #if defined(TCL_WITH_EXTERNAL_TOMMATH) || (TK_HEX_VERSION >= 0x08070000) +@@ -66,6 +69,12 @@ Copyright (C) 1994 Steen Lumholt. + #define USE_DEPRECATED_TOMMATH_API 1 + #endif + ++// As suggested by https://core.tcl-lang.org/tcl/wiki?name=Migrating+C+extensions+to+Tcl+9 ++#ifndef TCL_SIZE_MAX ++typedef int Tcl_Size; ++#define TCL_SIZE_MAX INT_MAX ++#endif ++ + #if !(defined(MS_WINDOWS) || defined(__CYGWIN__)) + #define HAVE_CREATEFILEHANDLER + #endif +@@ -316,6 +325,7 @@ typedef struct { + const Tcl_ObjType *ListType; + const Tcl_ObjType *ProcBodyType; + const Tcl_ObjType *StringType; ++ const Tcl_ObjType *UTF32StringType; + } TkappObject; + + #define Tkapp_Interp(v) (((TkappObject *) (v))->interp) +@@ -492,7 +502,7 @@ unicodeFromTclString(const char *s) + static PyObject * + unicodeFromTclObj(Tcl_Obj *value) + { +- int len; ++ Tcl_Size len; + #if USE_TCL_UNICODE + int byteorder = NATIVE_BYTEORDER; + const Tcl_UniChar *u = Tcl_GetUnicodeFromObj(value, &len); +@@ -520,6 +530,10 @@ class _tkinter.tktimertoken "TkttObject *" "&Tktt_Type_spec" + + /**** Tkapp Object ****/ + ++#if TK_MAJOR_VERSION >= 9 ++int Tcl_AppInit(Tcl_Interp *); ++#endif ++ + #ifndef WITH_APPINIT + int + Tcl_AppInit(Tcl_Interp *interp) +@@ -601,15 +615,41 @@ Tkapp_New(const char *screenName, const char *className, + } + + v->OldBooleanType = Tcl_GetObjType("boolean"); +- v->BooleanType = Tcl_GetObjType("booleanString"); +- v->ByteArrayType = Tcl_GetObjType("bytearray"); ++ { ++ Tcl_Obj *value; ++ int boolValue; ++ ++ /* Tcl 8.5 "booleanString" type is not registered ++ and is renamed to "boolean" in Tcl 9.0. ++ Based on approach suggested at ++ https://core.tcl-lang.org/tcl/info/3bb3bcf2da5b */ ++ value = Tcl_NewStringObj("true", -1); ++ Tcl_GetBooleanFromObj(NULL, value, &boolValue); ++ v->BooleanType = value->typePtr; ++ Tcl_DecrRefCount(value); ++ ++ // "bytearray" type is not registered in Tcl 9.0 ++ value = Tcl_NewByteArrayObj(NULL, 0); ++ v->ByteArrayType = value->typePtr; ++ Tcl_DecrRefCount(value); ++ } + v->DoubleType = Tcl_GetObjType("double"); ++ /* TIP 484 suggests retrieving the "int" type without Tcl_GetObjType("int") ++ since it is no longer registered in Tcl 9.0. But even though Tcl 8.7 ++ only uses the "wideInt" type on platforms with 32-bit long, it still has ++ a registered "int" type, which FromObj() should recognize just in case. */ + v->IntType = Tcl_GetObjType("int"); ++ if (v->IntType == NULL) { ++ Tcl_Obj *value = Tcl_NewIntObj(0); ++ v->IntType = value->typePtr; ++ Tcl_DecrRefCount(value); ++ } + v->WideIntType = Tcl_GetObjType("wideInt"); + v->BignumType = Tcl_GetObjType("bignum"); + v->ListType = Tcl_GetObjType("list"); + v->ProcBodyType = Tcl_GetObjType("procbody"); + v->StringType = Tcl_GetObjType("string"); ++ v->UTF32StringType = Tcl_GetObjType("utf32string"); + + /* Delete the 'exit' command, which can screw things up */ + Tcl_DeleteCommand(v->interp, "exit"); +@@ -1150,7 +1190,7 @@ FromObj(TkappObject *tkapp, Tcl_Obj *value) + } + + if (value->typePtr == tkapp->ByteArrayType) { +- int size; ++ Tcl_Size size; + char *data = (char*)Tcl_GetByteArrayFromObj(value, &size); + return PyBytes_FromStringAndSize(data, size); + } +@@ -1159,14 +1199,6 @@ FromObj(TkappObject *tkapp, Tcl_Obj *value) + return PyFloat_FromDouble(value->internalRep.doubleValue); + } + +- if (value->typePtr == tkapp->IntType) { +- long longValue; +- if (Tcl_GetLongFromObj(interp, value, &longValue) == TCL_OK) +- return PyLong_FromLong(longValue); +- /* If there is an error in the long conversion, +- fall through to wideInt handling. */ +- } +- + if (value->typePtr == tkapp->IntType || + value->typePtr == tkapp->WideIntType) { + result = fromWideIntObj(tkapp, value); +@@ -1184,8 +1216,8 @@ FromObj(TkappObject *tkapp, Tcl_Obj *value) + } + + if (value->typePtr == tkapp->ListType) { +- int size; +- int i, status; ++ Tcl_Size i, size; ++ int status; + PyObject *elem; + Tcl_Obj *tcl_elem; + +@@ -1211,21 +1243,12 @@ FromObj(TkappObject *tkapp, Tcl_Obj *value) + return result; + } + +- if (value->typePtr == tkapp->ProcBodyType) { +- /* fall through: return tcl object. */ +- } +- +- if (value->typePtr == tkapp->StringType) { ++ if (value->typePtr == tkapp->StringType || ++ value->typePtr == tkapp->UTF32StringType) ++ { + return unicodeFromTclObj(value); + } + +- if (tkapp->BooleanType == NULL && +- strcmp(value->typePtr->name, "booleanString") == 0) { +- /* booleanString type is not registered in Tcl */ +- tkapp->BooleanType = value->typePtr; +- return fromBoolean(tkapp, value); +- } +- + if (tkapp->BignumType == NULL && + strcmp(value->typePtr->name, "bignum") == 0) { + /* bignum type is not registered in Tcl */ +@@ -1250,9 +1273,9 @@ typedef struct Tkapp_CallEvent { + } Tkapp_CallEvent; + + static void +-Tkapp_CallDeallocArgs(Tcl_Obj** objv, Tcl_Obj** objStore, int objc) ++Tkapp_CallDeallocArgs(Tcl_Obj** objv, Tcl_Obj** objStore, Tcl_Size objc) + { +- int i; ++ Tcl_Size i; + for (i = 0; i < objc; i++) + Tcl_DecrRefCount(objv[i]); + if (objv != objStore) +@@ -1263,7 +1286,7 @@ Tkapp_CallDeallocArgs(Tcl_Obj** objv, Tcl_Obj** objStore, int objc) + interpreter thread, which may or may not be the calling thread. */ + + static Tcl_Obj** +-Tkapp_CallArgs(PyObject *args, Tcl_Obj** objStore, int *pobjc) ++Tkapp_CallArgs(PyObject *args, Tcl_Obj** objStore, Tcl_Size *pobjc) + { + Tcl_Obj **objv = objStore; + Py_ssize_t objc = 0, i; +@@ -1311,10 +1334,10 @@ Tkapp_CallArgs(PyObject *args, Tcl_Obj** objStore, int *pobjc) + Tcl_IncrRefCount(objv[i]); + } + } +- *pobjc = (int)objc; ++ *pobjc = (Tcl_Size)objc; + return objv; + finally: +- Tkapp_CallDeallocArgs(objv, objStore, (int)objc); ++ Tkapp_CallDeallocArgs(objv, objStore, (Tcl_Size)objc); + return NULL; + } + +@@ -1357,7 +1380,7 @@ Tkapp_CallProc(Tkapp_CallEvent *e, int flags) + { + Tcl_Obj *objStore[ARGSZ]; + Tcl_Obj **objv; +- int objc; ++ Tcl_Size objc; + int i; + ENTER_PYTHON + objv = Tkapp_CallArgs(e->args, objStore, &objc); +@@ -1408,7 +1431,7 @@ Tkapp_Call(PyObject *selfptr, PyObject *args) + { + Tcl_Obj *objStore[ARGSZ]; + Tcl_Obj **objv = NULL; +- int objc, i; ++ Tcl_Size objc; + PyObject *res = NULL; + TkappObject *self = (TkappObject*)selfptr; + int flags = TCL_EVAL_DIRECT | TCL_EVAL_GLOBAL; +@@ -1454,6 +1477,7 @@ Tkapp_Call(PyObject *selfptr, PyObject *args) + else + { + ++ int i; + objv = Tkapp_CallArgs(args, objStore, &objc); + if (!objv) + return NULL; +@@ -2139,13 +2163,12 @@ _tkinter_tkapp_splitlist(TkappObject *self, PyObject *arg) + /*[clinic end generated code: output=13b51d34386d36fb input=2b2e13351e3c0b53]*/ + { + char *list; +- int argc; ++ Tcl_Size argc, i; + const char **argv; + PyObject *v; +- int i; + + if (PyTclObject_Check(arg)) { +- int objc; ++ Tcl_Size objc; + Tcl_Obj **objv; + if (Tcl_ListObjGetElements(Tkapp_Interp(self), + ((PyTclObject*)arg)->value, diff --git a/pythonbuild/downloads.py b/pythonbuild/downloads.py index 7c2184e6..c3acead3 100644 --- a/pythonbuild/downloads.py +++ b/pythonbuild/downloads.py @@ -318,11 +318,11 @@ "version": "5.38.2.2", }, "tcl": { - "url": "https://prdownloads.sourceforge.net/tcl/tcl8.6.14-src.tar.gz", - "size": 11627322, - "sha256": "5880225babf7954c58d4fb0f5cf6279104ce1cd6aa9b71e9a6322540e1c4de66", - "version": "8.6.14", - "library_names": ["tcl8.6"], + "url": "https://prdownloads.sourceforge.net/tcl/tcl9.0.3-src.tar.gz", + "size": 11922915, + "sha256": "2537ba0c86112c8c953f7c09d33f134dd45c0fb3a71f2d7f7691fd301d2c33a6", + "version": "9.0.3", + "library_names": ["tcl9.0"], "licenses": ["TCL"], "license_file": "LICENSE.tcl.txt", }, @@ -335,11 +335,11 @@ "license_file": "LICENSE.tix.txt", }, "tk": { - "url": "https://prdownloads.sourceforge.net/tcl/tk8.6.14-src.tar.gz", - "size": 4510695, - "sha256": "8ffdb720f47a6ca6107eac2dd877e30b0ef7fac14f3a84ebbd0b3612cee41a94", - "version": "8.6.14", - "library_names": ["tk8.6"], + "url": "https://prdownloads.sourceforge.net/tcl/tk9.0.3-src.tar.gz", + "size": 4644835, + "sha256": "bf344efadb618babb7933f69275620f72454d1c8220130da93e3f7feb0efbf9b", + "version": "9.0.3", + "library_names": ["tk9.0"], "licenses": ["TCL"], "license_file": "LICENSE.tcl.txt", }, diff --git a/src/validation.rs b/src/validation.rs index 5886f1ea..46f9f441 100644 --- a/src/validation.rs +++ b/src/validation.rs @@ -286,7 +286,7 @@ static ELF_ALLOWED_LIBRARIES_BY_MODULE: Lazy> = Lazy::new(|| { max_compatibility_version: "1.0.0".try_into().unwrap(), required: true, }, + MachOAllowedDylib { + name: "/System/Library/Frameworks/Security.framework/Versions/A/Security".to_string(), + max_compatibility_version: "1.0.0".try_into().unwrap(), + required: true, + }, MachOAllowedDylib { name: "/usr/lib/libedit.3.dylib".to_string(), max_compatibility_version: "2.0.0".try_into().unwrap(), @@ -494,13 +499,13 @@ static ALLOWED_DYLIBS_BY_MODULE: Lazy