From 530dbaf32d2f40068e05933480d93df3bb3c5854 Mon Sep 17 00:00:00 2001 From: Ilya Etingof Date: Tue, 24 Jul 2018 08:07:38 +0200 Subject: 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. --- CHANGES.rst | 2 ++ pyasn1/type/univ.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) 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) -- cgit v1.2.1