]> Cypherpunks.ru repositories - pyderasn.git/blobdiff - pyderasn.py
Do not shadow DecodeError for optional field
[pyderasn.git] / pyderasn.py
index c2d8f4409ee9f8d7b50a75956ed5d03a72b08db5..e8e200c69196820912b314f0fa7e84844eeb47d0 100755 (executable)
@@ -4885,8 +4885,8 @@ class Sequence(Obj):
                     ctx=ctx,
                     _ctx_immutable=False,
                 )
-            except TagMismatch:
-                if spec.optional:
+            except TagMismatch as err:
+                if (len(err.decode_path) == len(decode_path) + 1) and spec.optional:
                     continue
                 raise