mirror of
https://github.com/nmap/nmap.git
synced 2026-08-04 14:49:29 +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:
parent
57135c89c1
commit
338dcb115c
1 changed files with 2 additions and 0 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue