[3.12] gh-111531: Tkinter: fix reference leaks in bind_class() and bind_all() (GH-111533) (GH-111535)
https://github.com/python/cpython/commit/dde5a99ba2173cf1ffbc1692d6800061025... commit: dde5a99ba2173cf1ffbc1692d68000610250eacd branch: 3.12 author: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> committer: serhiy-storchaka <storchaka@gmail.com> date: 2023-10-31T07:26:31Z summary: [3.12] gh-111531: Tkinter: fix reference leaks in bind_class() and bind_all() (GH-111533) (GH-111535) (cherry picked from commit e3353c498d79f0f3f108a9baf8807a12e77c2ebe) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> files: A Misc/NEWS.d/next/Library/2023-10-31-07-46-56.gh-issue-111531.6zUV_G.rst M Lib/tkinter/__init__.py diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py index c59f8d11e8a9d..cb3e5f1ebab49 100644 --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -1459,7 +1459,7 @@ def bind_all(self, sequence=None, func=None, add=None): 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 @@ def bind_class(self, className, sequence=None, func=None, add=None): 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 index 0000000000000..b722f0414184b --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-10-31-07-46-56.gh-issue-111531.6zUV_G.rst @@ -0,0 +1,2 @@ +Fix reference leaks in ``bind_class()`` and ``bind_all()`` methods of +:mod:`tkinter` widgets.
participants (1)
-
serhiy-storchaka