From b5567cd2c682cede9690631185c30894fbae7d94 Mon Sep 17 00:00:00 2001 From: Kaushik Kulkarni Date: Thu, 28 Apr 2022 08:37:40 -0500 Subject: [PATCH] Record.__eq__: early exit for identical instances --- pytools/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pytools/__init__.py b/pytools/__init__.py index 2fd39f9..225e2df 100644 --- a/pytools/__init__.py +++ b/pytools/__init__.py @@ -463,6 +463,8 @@ class Record(RecordWithoutPickling): setattr(self, key, value) def __eq__(self, other): + if self is other: + return True return (self.__class__ == other.__class__ and self.__getstate__() == other.__getstate__()) -- GitLab