mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
bpo-42759: Fix equality comparison of Variable and Font in Tkinter (GH-23968)
Objects which belong to different Tcl interpreters are now always different, even if they have the same name.
This commit is contained in:
parent
156b7f7052
commit
1df56bc059
5 changed files with 27 additions and 11 deletions
|
|
@ -516,15 +516,11 @@ class Variable:
|
|||
self._tk.call("trace", "vinfo", self._name))]
|
||||
|
||||
def __eq__(self, other):
|
||||
"""Comparison for equality (==).
|
||||
|
||||
Note: if the Variable's master matters to behavior
|
||||
also compare self._master == other._master
|
||||
"""
|
||||
if not isinstance(other, Variable):
|
||||
return NotImplemented
|
||||
return self.__class__.__name__ == other.__class__.__name__ \
|
||||
and self._name == other._name
|
||||
return (self._name == other._name
|
||||
and self.__class__.__name__ == other.__class__.__name__
|
||||
and self._tk == other._tk)
|
||||
|
||||
|
||||
class StringVar(Variable):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue