From 37694b9a1a95a8f876f09f21bceacbfd7abc6716 Mon Sep 17 00:00:00 2001 From: Josh Watson Date: Tue, 6 Nov 2018 10:53:08 -0800 Subject: Add type check to `Variable.__eq__` `Variable.__eq__` fails to check if the other value is actually a Variable object before comparing member properties. This fixes the exception that gets raised when comparing a Variable against something else. --- python/function.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'python/function.py') diff --git a/python/function.py b/python/function.py index 3f908ef6..dce57975 100644 --- a/python/function.py +++ b/python/function.py @@ -293,6 +293,8 @@ class Variable(object): return self.name def __eq__(self, other): + if not isinstance(other, Variable): + return False return (self.identifier, self.function) == (other.identifier, other.function) def __hash__(self): -- cgit v1.3.1