https://github.com/python/cpython/commit/4f81915cf59389b4ac03972561b53ea2b662696f
commit: 4f81915cf59389b4ac03972561b53ea2b662696f
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2024-05-15T17:16:03Z
summary:

[3.13] gh-118760: Fix errors in calling Tkinter bindings on Windows (GH-118782) 
(GH-119072)

For unknown reasons some arguments for Tkinter binding can be created
as a 1-tuple containing a Tcl_Obj when wantobjects is 2.
(cherry picked from commit 5b88d95cc542cf02303c6fe0e8719a93544decdb)

Co-authored-by: Serhiy Storchaka <[email protected]>

files:
A Misc/NEWS.d/next/Library/2024-05-08-21-13-56.gh-issue-118760.mdmH3T.rst
M Lib/tkinter/__init__.py

diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py
index daecf4eb2ea522..f03da0ff5f98ec 100644
--- a/Lib/tkinter/__init__.py
+++ b/Lib/tkinter/__init__.py
@@ -1727,6 +1727,9 @@ def getint_event(s):
             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 00000000000000..89ef9334fbc65d
--- /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.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to