From: tezeb Date: Sun, 25 Sep 2016 18:18:02 +0000 (+0200) Subject: Check for header attribute when comparing X-Git-Tag: v0.25~60^2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=aae68b7786778014f4c1599aa3c620f347cce28a;p=pyelftools.git Check for header attribute when comparing When checking against None it throws exception, while it's quite easy to prevent(and check against None seems quite obvious). --- diff --git a/elftools/elf/sections.py b/elftools/elf/sections.py index 2058053..76f9f2a 100644 --- a/elftools/elf/sections.py +++ b/elftools/elf/sections.py @@ -41,7 +41,11 @@ class Section(object): return self.header[name] def __eq__(self, other): - return self.header == other.header + try: + return self.header == other.header + except AttributeError: + return False + def __hash__(self): return hash(self.header)