summaryrefslogtreecommitdiff
path: root/pysnmp
diff options
context:
space:
mode:
Diffstat (limited to 'pysnmp')
-rw-r--r--pysnmp/proto/rfc1902.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/pysnmp/proto/rfc1902.py b/pysnmp/proto/rfc1902.py
index 12237482..3370f478 100644
--- a/pysnmp/proto/rfc1902.py
+++ b/pysnmp/proto/rfc1902.py
@@ -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)):