From c787751fec59b9e4f651937a50ae49e1ca7d4c56 Mon Sep 17 00:00:00 2001 From: gaogaotiantian Date: Tue, 2 Feb 2021 18:51:00 -0800 Subject: [PATCH] Use is instead of == for variable compare (#7) --- src/watchpoints/watch_element.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/watchpoints/watch_element.py b/src/watchpoints/watch_element.py index 96a79a9..afaac86 100644 --- a/src/watchpoints/watch_element.py +++ b/src/watchpoints/watch_element.py @@ -60,7 +60,7 @@ def changed(self, frame): if "variable" in self.track: if frame is self.frame and self.localvar is not None: if self.localvar in frame.f_locals: - if frame.f_locals[self.localvar] != self.obj: + if frame.f_locals[self.localvar] is not self.obj: self.obj = frame.f_locals[self.localvar] return True, True else: @@ -68,14 +68,14 @@ def changed(self, frame): if self.parent is not None and self.subscr is not None: try: - if self.parent[self.subscr] != self.obj: + if self.parent[self.subscr] is not self.obj: self.obj = self.parent[self.subscr] return True, True except (IndexError, KeyError): return True, False elif self.parent is not None and self.attr is not None: try: - if getattr(self.parent, self.attr) != self.obj: + if getattr(self.parent, self.attr) is not self.obj: self.obj = getattr(self.parent, self.attr) return True, True except AttributeError: