From bc12aae8c1efe84abd16f9985ffe3f3220225d13 Mon Sep 17 00:00:00 2001 From: Siu Kwan Lam Date: Tue, 11 Mar 2014 14:45:32 -0500 Subject: [PATCH] Hashable Module and fix Module __eq__ --- llvm/core.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/llvm/core.py b/llvm/core.py index 650bb90..4db8135 100644 --- a/llvm/core.py +++ b/llvm/core.py @@ -452,12 +452,12 @@ class Module(llvm.Wrapper): """ return str(self._ptr) + def __hash__(self): + return id(self._ptr) + def __eq__(self, rhs): - assert isinstance(rhs, Module), type(rhs) if isinstance(rhs, Module): - return str(self) == str(rhs) - else: - return False + return self._ptr == rhs._ptr def __ne__(self, rhs): return not (self == rhs)