summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2024-05-15 16:49:00 (GMT)
committerGitHub <noreply@github.com>2024-05-15 16:49:00 (GMT)
commit5b88d95cc542cf02303c6fe0e8719a93544decdb (patch)
treeca2132f639fba7f64a047e9226406774d3012c61
parent7d722b7d3ac78bfa74a5d2f21513ffbf4f85cff2 (diff)
downloadcpython-5b88d95cc542cf02303c6fe0e8719a93544decdb.zip
cpython-5b88d95cc542cf02303c6fe0e8719a93544decdb.tar.gz
cpython-5b88d95cc542cf02303c6fe0e8719a93544decdb.tar.bz2
gh-118760: Fix errors in calling Tkinter bindings on Windows (GH-118782)
For unknown reasons some arguments for Tkinter binding can be created as a 1-tuple containing a Tcl_Obj when wantobjects is 2.
-rw-r--r--Lib/tkinter/__init__.py3
-rw-r--r--Misc/NEWS.d/next/Library/2024-05-08-21-13-56.gh-issue-118760.mdmH3T.rst1
2 files changed, 4 insertions, 0 deletions
diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py
index daecf4e..f03da0f 100644
--- a/Lib/tkinter/__init__.py
+++ b/Lib/tkinter/__init__.py
@@ -1727,6 +1727,9 @@ class Misc:
except (ValueError, TclError):
return s
+ if any(isinstance(s, tuple) for s in args):
+ args = [s[0] if isinstance(s, tuple) and len(s) == 1 else s
+ for s in args]
nsign, b, f, h, k, s, t, w, x, y, A, E, K, N, W, T, X, Y, D = args
# Missing: (a, c, d, m, o, v, B, R)
e = Event()
diff --git a/Misc/NEWS.d/next/Library/2024-05-08-21-13-56.gh-issue-118760.mdmH3T.rst b/Misc/NEWS.d/next/Library/2024-05-08-21-13-56.gh-issue-118760.mdmH3T.rst
new file mode 100644
index 0000000..89ef933
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2024-05-08-21-13-56.gh-issue-118760.mdmH3T.rst
@@ -0,0 +1 @@
+Fix errors in calling Tkinter bindings on Windows.