]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-111531: Tkinter: fix reference leaks in bind_class() and bind_all() (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 31 Oct 2023 07:13:29 +0000 (08:13 +0100)
committerGitHub <noreply@github.com>
Tue, 31 Oct 2023 07:13:29 +0000 (07:13 +0000)
(cherry picked from commit e3353c498d79f0f3f108a9baf8807a12e77c2ebe)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Lib/tkinter/__init__.py
Misc/NEWS.d/next/Library/2023-10-31-07-46-56.gh-issue-111531.6zUV_G.rst [new file with mode: 0644]

index 6ae9839055382cdd06e758db4d0a603ad61c618d..704e7b8364b8ea6e62dcdfe2fc50ce7a5f2293b7 100644 (file)
@@ -1459,7 +1459,7 @@ class Misc:
         An additional boolean parameter ADD specifies whether FUNC will
         be called additionally to the other bound function or whether
         it will replace the previous function. See bind for the return value."""
-        return self._bind(('bind', 'all'), sequence, func, add, 0)
+        return self._root()._bind(('bind', 'all'), sequence, func, add, True)
 
     def unbind_all(self, sequence):
         """Unbind for all widgets for event SEQUENCE all functions."""
@@ -1473,7 +1473,7 @@ class Misc:
         whether it will replace the previous function. See bind for
         the return value."""
 
-        return self._bind(('bind', className), sequence, func, add, 0)
+        return self._root()._bind(('bind', className), sequence, func, add, True)
 
     def unbind_class(self, className, sequence):
         """Unbind for all widgets with bindtag CLASSNAME for event SEQUENCE
diff --git a/Misc/NEWS.d/next/Library/2023-10-31-07-46-56.gh-issue-111531.6zUV_G.rst b/Misc/NEWS.d/next/Library/2023-10-31-07-46-56.gh-issue-111531.6zUV_G.rst
new file mode 100644 (file)
index 0000000..b722f04
--- /dev/null
@@ -0,0 +1,2 @@
+Fix reference leaks in ``bind_class()`` and ``bind_all()`` methods of
+:mod:`tkinter` widgets.