Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-111531: Tkinter: fix reference leaks in bind_class() and bind_all() (
GH-111533)

(cherry picked from commit e3353c4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
  • Loading branch information
serhiy-storchaka authored and miss-islington committed Oct 31, 2023
commit 86eeefab3a53448da46f90b9f9388477dc75a416
4 changes: 2 additions & 2 deletions Lib/tkinter/__init__.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix reference leaks in ``bind_class()`` and ``bind_all()`` methods of
:mod:`tkinter` widgets.