aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/tkinter/__init__.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2020-12-29 12:56:55 +0200
committerGitHub <noreply@github.com>2020-12-29 12:56:55 +0200
commit1df56bc0597a051c13d53514e120e9b6764185f8 (patch)
treec3dfca8059205e1a4d6193097f4066b27f794154 /Lib/tkinter/__init__.py
parent156b7f7052102ee1633a18e9a136ad8c38f66db0 (diff)
downloadcpython-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__.py10
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):