Skip to content
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

python-tk@3.13: apply fixes for TCL 9 #201830

Merged
merged 2 commits into from
Dec 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 63 additions & 6 deletions Formula/p/python-tk@3.13.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ class PythonTkAT313 < Formula
end

bottle do
sha256 cellar: :any, arm64_sequoia: "1dcd596238164b46d80d599476ba8329aba85694e64c911af85a5db48f08a81f"
sha256 cellar: :any, arm64_sonoma: "25b1ddbb5d864611243b65d9047ca97994fdcc3622ed30dfd16d8ee077d5e5d6"
sha256 cellar: :any, arm64_ventura: "05c096c2b2168d7f210f90f2bc5ba771d089dfb209f732a1091a31e1b8722c98"
sha256 cellar: :any, sonoma: "68759e414cd097da518ada18552b9af089dc693baba9e180d8d0cb0f76af3c76"
sha256 cellar: :any, ventura: "b6d37b84ac097ea3fbb1fb7a64458da203785f78c4b20e903048ff63360084d3"
sha256 cellar: :any_skip_relocation, x86_64_linux: "ed80cb90348e53c81678d267df3212ac0927eb57d90cac59f2222ee652d49925"
rebuild 1
sha256 cellar: :any, arm64_sequoia: "f41ef35a57bfa83b74bad81837510e1efebd079ff3192e23a3cb161fc19d5c9d"
sha256 cellar: :any, arm64_sonoma: "4b8daf098be87f34b73083eaf03e30c258457a06635e0c41ba439f2b5b2c7693"
sha256 cellar: :any, arm64_ventura: "4b13b238ccb530cf20fbd92047b11da5858a7afd1edbb54d8234d1327c3be43b"
sha256 cellar: :any, sonoma: "aa7a3dfe8280101017bd0b854a824573332399994441243709a0885fba8cf572"
sha256 cellar: :any, ventura: "4216a3022ec3e201a9a9a8d5754a3deb0e5303394f2333b21bfb22e34b2a20b5"
sha256 cellar: :any_skip_relocation, x86_64_linux: "2c0eaf843c3d5c9fee27adfe2f3335e9b550944a2f384b705c48eace8c4fa462"
end

depends_on "python@3.13"
Expand All @@ -25,6 +26,17 @@ def python3
"python3.13"
end

# Apply commit from open PR to fix TCL 9 threaded detection
# PR ref: https://github.com/python/cpython/pull/128103
patch do
url "https://github.com/python/cpython/commit/a2019e226e4650cef35ebfde7ecd7ce044a4a670.patch?full_index=1"
sha256 "03c4b6a293d4a51f534858657717bdc1465c42acb3b78e64c41f9011f966e449"
end

# Backport of https://github.com/python/cpython/commit/47cbf038850852cdcbe7a404ed7c64542340d58a
# TODO: Remove if https://github.com/python/cpython/pull/127364 is merged and released
patch :DATA

def install
xy = Language::Python.major_minor_version python3
python_include = if OS.mac?
Expand Down Expand Up @@ -64,3 +76,48 @@ def install
system python3, "-c", "import tkinter; root = tkinter.Tk()"
end
end

__END__
diff --git a/Lib/tkinter/ttk.py b/Lib/tkinter/ttk.py
index 073b3ae20797c3..8ddb7f97e3b233 100644
--- a/Lib/tkinter/ttk.py
+++ b/Lib/tkinter/ttk.py
@@ -321,6 +321,8 @@ def _tclobj_to_py(val):
elif hasattr(val, 'typename'): # some other (single) Tcl object
val = _convert_stringval(val)

+ if isinstance(val, tuple) and len(val) == 0:
+ return ''
return val

def tclobjs_to_py(adict):
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index b0b70ccb8cc3d3..45897817a56051 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -325,6 +325,7 @@ typedef struct {
const Tcl_ObjType *ListType;
const Tcl_ObjType *StringType;
const Tcl_ObjType *UTF32StringType;
+ const Tcl_ObjType *PixelType;
} TkappObject;

#define Tkapp_Interp(v) (((TkappObject *) (v))->interp)
@@ -637,6 +638,7 @@ Tkapp_New(const char *screenName, const char *className,
v->ListType = Tcl_GetObjType("list");
v->StringType = Tcl_GetObjType("string");
v->UTF32StringType = Tcl_GetObjType("utf32string");
+ v->PixelType = Tcl_GetObjType("pixel");

/* Delete the 'exit' command, which can screw things up */
Tcl_DeleteCommand(v->interp, "exit");
@@ -1236,7 +1238,8 @@ FromObj(TkappObject *tkapp, Tcl_Obj *value)
}

if (value->typePtr == tkapp->StringType ||
- value->typePtr == tkapp->UTF32StringType)
+ value->typePtr == tkapp->UTF32StringType ||
+ value->typePtr == tkapp->PixelType)
{
return unicodeFromTclObj(tkapp, value);
}
Loading