diff options
author | Ilya Etingof <etingof@gmail.com> | 2018-07-24 08:07:38 +0200 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2018-07-24 08:07:38 +0200 |
commit | 530dbaf32d2f40068e05933480d93df3bb3c5854 (patch) | |
tree | 1a5cf88390bff8860fa2a02ea9ff93a1f90d0ffe | |
parent | 939be5fabe8c8ed8fcb334b07c84349f99cb0e59 (diff) | |
download | pyasn1-git-530dbaf32d2f40068e05933480d93df3bb3c5854.tar.gz |
Fix Sequence/Set.prettyPrint crash
When calling `.prettyPrint()` on Sequence/Set components,
make sure the component is a value object (not schema)
because calling `.prettyPrint` on a schema object is
likely to fail.
-rw-r--r-- | CHANGES.rst | 2 | ||||
-rw-r--r-- | pyasn1/type/univ.py | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index ffbcf83..33614ad 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,8 @@ Revision 0.4.4, released XX-07-2018 - Fixed native encoder type map to include all ASN.1 types rather than just ambiguous ones +- Fixed crash in `.prettyPrint` of `Sequence` and `Set` occuring + at OPTIONAL components Revision 0.4.3, released 23-05-2018 ----------------------------------- diff --git a/pyasn1/type/univ.py b/pyasn1/type/univ.py index a19f6ba..898cf25 100644 --- a/pyasn1/type/univ.py +++ b/pyasn1/type/univ.py @@ -2457,7 +2457,7 @@ class SequenceAndSetBase(base.AbstractConstructedAsn1Item): scope += 1 representation = self.__class__.__name__ + ':\n' for idx, componentValue in enumerate(self._componentValues): - if componentValue is not noValue: + if componentValue is not noValue and componentValue.isValue: representation += ' ' * scope if self.componentType: representation += self.componentType.getNameByPosition(idx) |