From 338dcb115c5e941bf5ad98da61243aafcb1aef09 Mon Sep 17 00:00:00 2001 From: dmiller Date: Mon, 23 Dec 2013 20:12:40 +0000 Subject: [PATCH] [Ndiff] Fix DeprecationWarning under python -3 Classes that inherit __hash__ and comparison functions like __eq__ (e.g. from object) but only override one of them will break under Python 3. This is because a class shouldn't use one criterion for equality and a different one for hashing. Explicitly discarding the inherited __hash__ method disables this warning and makes the class unhashable (not a problem in this case). --- ndiff/ndiff.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ndiff/ndiff.py b/ndiff/ndiff.py index d0205b7a5..5692d1fb0 100755 --- a/ndiff/ndiff.py +++ b/ndiff/ndiff.py @@ -330,6 +330,7 @@ class Service(object): # self.ostype = None # self.devicetype = None + __hash__ = None def __eq__(self, other): return self.name == other.name \ and self.product == other.product \ @@ -383,6 +384,7 @@ class ScriptResult(object): self.id = None self.output = None + __hash__ = None def __eq__(self, other): return self.id == other.id and self.output == other.output