]> Cypherpunks.ru repositories - pyderasn.git/commitdiff
Faster Set readiness determining during decode
authorSergey Matveev <stargrave@stargrave.org>
Mon, 10 Feb 2020 16:09:23 +0000 (19:09 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Mon, 10 Feb 2020 16:12:35 +0000 (19:12 +0300)
pyderasn.py

index ea1b0b926ca295cea669fedaa2ed7d2c279f7f98..ed5b763ccef4123c790d52569d9b376ef2acf168 100755 (executable)
@@ -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