diff --git a/git/objects/base.py b/git/objects/base.py index 5f2f78093..9c1a0bb92 100644 --- a/git/objects/base.py +++ b/git/objects/base.py @@ -77,10 +77,14 @@ def _set_cache_(self, attr): def __eq__(self, other): """:return: True if the objects have the same SHA1""" + if not hasattr(other, 'binsha'): + return False return self.binsha == other.binsha def __ne__(self, other): """:return: True if the objects do not have the same SHA1 """ + if not hasattr(other, 'binsha'): + return True return self.binsha != other.binsha def __hash__(self):