mirror of
https://github.com/JoelBender/bacpypes
synced 2025-09-28 22:15:23 +08:00
Python3 no longer uses __cmp__, incorrect initialization for octet strings
This commit is contained in:
parent
22c5fe48f3
commit
34ed6bd399
|
@ -451,6 +451,8 @@ class Atomic(object):
|
||||||
_app_tag = None
|
_app_tag = None
|
||||||
|
|
||||||
def __cmp__(self, other):
|
def __cmp__(self, other):
|
||||||
|
# sys.stderr.write("__cmp__ %r %r\n" % (self, other))
|
||||||
|
|
||||||
# hoop jump it
|
# hoop jump it
|
||||||
if not isinstance(other, self.__class__):
|
if not isinstance(other, self.__class__):
|
||||||
other = self.__class__(other)
|
other = self.__class__(other)
|
||||||
|
@ -463,6 +465,26 @@ class Atomic(object):
|
||||||
else:
|
else:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
def __lt__(self, other):
|
||||||
|
# sys.stderr.write("__lt__ %r %r\n" % (self, other))
|
||||||
|
|
||||||
|
# hoop jump it
|
||||||
|
if not isinstance(other, self.__class__):
|
||||||
|
other = self.__class__(other)
|
||||||
|
|
||||||
|
# now compare the values
|
||||||
|
return (self.value < other.value)
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
sys.stderr.write("__eq__ %r %r\n" % (self, other))
|
||||||
|
|
||||||
|
# hoop jump it
|
||||||
|
if not isinstance(other, self.__class__):
|
||||||
|
other = self.__class__(other)
|
||||||
|
|
||||||
|
# now compare the values
|
||||||
|
return self.value == other.value
|
||||||
|
|
||||||
#
|
#
|
||||||
# Null
|
# Null
|
||||||
#
|
#
|
||||||
|
@ -738,7 +760,7 @@ class OctetString(Atomic):
|
||||||
_app_tag = Tag.octetStringAppTag
|
_app_tag = Tag.octetStringAppTag
|
||||||
|
|
||||||
def __init__(self, arg=None):
|
def __init__(self, arg=None):
|
||||||
self.value = ''
|
self.value = bytes()
|
||||||
|
|
||||||
if arg is None:
|
if arg is None:
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in New Issue
Block a user