Skip to content

Commit

Permalink
Fix Sequence/Set.prettyPrint crash
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
etingof committed Jul 24, 2018
1 parent 939be5f commit 530dbaf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----------------------------------
Expand Down
2 changes: 1 addition & 1 deletion pyasn1/type/univ.py
Original file line number Diff line number Diff line change
Expand Up @@ -2457,7 +2457,7 @@ def prettyPrint(self, scope=0):
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)
Expand Down

0 comments on commit 530dbaf

Please sign in to comment.