Fix `Bits` initialization with `namedValues`
parent
a93241007b
commit
3e8fd37ee1
|
@ -1,5 +1,4 @@
|
|||
|
||||
|
||||
Revision 5.0.0, released 2018-07-??
|
||||
-----------------------------------
|
||||
|
||||
|
@ -36,6 +35,7 @@ Revision 4.4.5, released 2018-07-XX
|
|||
- Fixed typo in RFC1158 module
|
||||
- Fixed possible infinite loop in GETBULK response PDU builder
|
||||
- Fixed memory leak in the `config.delContext()` VACM management harness
|
||||
- Fixed `Bits` class initialization when enumeration values are given
|
||||
|
||||
Revision 4.4.4, released 2018-01-03
|
||||
-----------------------------------
|
||||
|
|
|
@ -598,11 +598,12 @@ class Bits(OctetString):
|
|||
"""
|
||||
namedValues = namedval.NamedValues()
|
||||
|
||||
def __init__(self, value=univ.noValue, **kwargs):
|
||||
if 'namedValues' not in kwargs:
|
||||
kwargs['namedValues'] = self.namedValues
|
||||
def __new__(cls, *args, **kwargs):
|
||||
if 'namedValues' in kwargs:
|
||||
Bits = cls.withNamedBits(**kwargs.pop('namedValues'))
|
||||
return Bits(*args, **kwargs)
|
||||
|
||||
OctetString.__init__(self, value, **kwargs)
|
||||
return OctetString.__new__(cls)
|
||||
|
||||
def prettyIn(self, bits):
|
||||
if not isinstance(bits, (tuple, list)):
|
||||
|
|
Loading…
Reference in New Issue