]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-118760: Fix errors in calling Tkinter bindings on Windows (GH-118782) ...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 15 May 2024 17:16:03 +0000 (19:16 +0200)
committerGitHub <noreply@github.com>
Wed, 15 May 2024 17:16:03 +0000 (17:16 +0000)
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 <storchaka@gmail.com>
Lib/tkinter/__init__.py
Misc/NEWS.d/next/Library/2024-05-08-21-13-56.gh-issue-118760.mdmH3T.rst [new file with mode: 0644]

index daecf4eb2ea52201c684c69ad76c8bcc77a00707..f03da0ff5f98ec291b20cdc67088687a4b5f1855 100644 (file)
@@ -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 (file)
index 0000000..89ef933
--- /dev/null
@@ -0,0 +1 @@
+Fix errors in calling Tkinter bindings on Windows.