projects
/
systemd
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f9d1709
)
test: introduce __eq__() and __ne__()
author
Yu Watanabe
<watanabe.yu+github@gmail.com>
Thu, 13 Oct 2022 08:41:45 +0000
(17:41 +0900)
committer
Yu Watanabe
<watanabe.yu+github@gmail.com>
Thu, 13 Oct 2022 08:41:48 +0000
(17:41 +0900)
Suggested by CodeQL#160 (https://github.com/systemd/systemd/security/code-scanning/160).
test/sd-script.py
patch
|
blob
|
history
diff --git
a/test/sd-script.py
b/test/sd-script.py
index 7662b12ab802a2dc4482ef9da97a0f322b97e156..51ebf70c39ecab231f55d66ebfb902418fe070c1 100644
(file)
--- a/
test/sd-script.py
+++ b/
test/sd-script.py
@@
-100,6
+100,12
@@
class SD(object):
def __cmp__(self, other):
return cmp(self._num, other._num)
+ def __eq__(self, other):
+ return self.__cmp__(other) == 0
+
+ def __ne__(self, other):
+ return not self.__eq__(other)
+
def __hash__(self):
return hash(self._num)