summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Matveev <stargrave@stargrave.org>2020-02-10 19:09:23 +0300
committerSergey Matveev <stargrave@stargrave.org>2020-02-10 19:12:35 +0300
commitad6ac8681ad5479b7274165a056624433e0ca2f1 (patch)
tree594b217dfc8e4af83f7bcb37ac84fbb8fbce6732
parenta5f63bdd812919be17945607d974825895448804 (diff)
downloadpyderasn-ad6ac8681ad5479b7274165a056624433e0ca2f1.tar.xz
Faster Set readiness determining during decode
-rwxr-xr-xpyderasn.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/pyderasn.py b/pyderasn.py
index ea1b0b9..ed5b763 100755
--- a/pyderasn.py
+++ b/pyderasn.py
@@ -5816,13 +5816,14 @@ class Set(Sequence):
tail = v[EOC_LEN:]
obj.lenindef = True
obj._value = values
- if not obj.ready:
- raise DecodeError(
- "not all values are ready",
- klass=self.__class__,
- decode_path=decode_path,
- offset=offset,
- )
+ for name, spec in iteritems(self.specs):
+ if name not in values and not spec.optional:
+ raise DecodeError(
+ "%s value is not ready" % name,
+ klass=self.__class__,
+ decode_path=decode_path,
+ offset=offset,
+ )
obj.ber_encoded = ber_encoded
return obj, tail