summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Etingof <etingof@gmail.com>2017-09-02 01:06:47 +0200
committerIlya Etingof <etingof@gmail.com>2017-09-02 01:06:47 +0200
commita364b3a3764976df8bb0e0dd3f9c4cf8d33da5d0 (patch)
tree3a0b450d40b31ef712427625bee1f65f398b4b0a
parentdbeb8b423bde649899cac009f65501f25e0de4d3 (diff)
downloadpyasn1-git-a364b3a3764976df8bb0e0dd3f9c4cf8d33da5d0.tar.gz
fixed Sequence.prettyprintType crash
-rw-r--r--pyasn1/type/univ.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/pyasn1/type/univ.py b/pyasn1/type/univ.py
index ffabf6d..63c21eb 100644
--- a/pyasn1/type/univ.py
+++ b/pyasn1/type/univ.py
@@ -2369,9 +2369,12 @@ class SequenceAndSetBase(base.AbstractConstructedAsn1Item):
def prettyPrintType(self, scope=0):
scope += 1
representation = '%s -> %s {\n' % (self.tagSet, self.__class__.__name__)
- for idx, componentType in enumerate(self.componentType):
+ for idx, componentType in enumerate(self.componentType.values() or self._componentValues):
representation += ' ' * scope
- representation += '"%s"' % self.componentType.getNameByPosition(idx)
+ if self.componentType:
+ representation += '"%s"' % self.componentType.getNameByPosition(idx)
+ else:
+ representation += '"%s"' % self._dynamicNames.getNameByPosition(idx)
representation = '%s = %s\n' % (
representation, componentType.prettyPrintType(scope)
)