summaryrefslogtreecommitdiff
path: root/pysnmp
diff options
context:
space:
mode:
authorIlya Etingof <etingof@gmail.com>2018-07-20 09:05:29 +0200
committerIlya Etingof <etingof@gmail.com>2018-07-20 09:57:16 +0200
commit3e8fd37ee1f6b736ed4ac8a3351e120e976667ae (patch)
tree344dabf4ef89f7ada09b93584e5853d851f31bd0 /pysnmp
parenta93241007b970c458a0233c16ae2ef82dc107290 (diff)
downloadpysnmp-git-3e8fd37ee1f6b736ed4ac8a3351e120e976667ae.tar.gz
Fix `Bits` initialization with `namedValues`
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)):