diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2020-12-29 12:56:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-29 12:56:55 +0200 |
commit | 1df56bc0597a051c13d53514e120e9b6764185f8 (patch) | |
tree | c3dfca8059205e1a4d6193097f4066b27f794154 /Lib/tkinter/__init__.py | |
parent | 156b7f7052102ee1633a18e9a136ad8c38f66db0 (diff) | |
download | cpython-1df56bc0597a051c13d53514e120e9b6764185f8.tar.gz cpython-1df56bc0597a051c13d53514e120e9b6764185f8.zip |
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.
Diffstat (limited to 'Lib/tkinter/__init__.py')
-rw-r--r-- | Lib/tkinter/__init__.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py index fec56553e42..57ac3fb5cf6 100644 --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -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): |