1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-24 00:19:01 +00:00

[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).
This commit is contained in:
dmiller
2013-12-23 20:12:40 +00:00
parent 57135c89c1
commit 338dcb115c

View File

@@ -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