Skip to content

Commit

Permalink
[3.11] gh-111531: Tkinter: fix reference leaks in bind_class() and bi…
Browse files Browse the repository at this point in the history
…nd_all() (GH-111533) (GH-111536)

(cherry picked from commit e3353c4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
  • Loading branch information
miss-islington and serhiy-storchaka committed Oct 31, 2023
1 parent c5f6c63 commit c66f0be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Lib/tkinter/__init__.py
Expand Up @@ -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."""
Expand All @@ -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
Expand Down
@@ -0,0 +1,2 @@
Fix reference leaks in ``bind_class()`` and ``bind_all()`` methods of
:mod:`tkinter` widgets.

0 comments on commit c66f0be

Please sign in to comment.