Skip to content

Commit

Permalink
Improve open maps debugging in decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
etingof committed Sep 7, 2019
1 parent aa5eb55 commit bac135a
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions pyasn1/codec/ber/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,10 @@ def valueDecoder(self, substrate, asn1Spec,
openTypes = options.get('openTypes', {})

if LOG:
LOG('using open types map: %r' % openTypes)
LOG('user-specified open types map:')

for k, v in openTypes.items():
LOG('%s -> %r' % (k, v))

if openTypes or options.get('decodeOpenTypes', False):

Expand All @@ -658,6 +661,17 @@ def valueDecoder(self, substrate, asn1Spec,

except KeyError:

if LOG:
LOG('default open types map of component '
'"%s.%s" governed by component "%s.%s"'
':' % (asn1Object.__class__.__name__,
namedType.name,
asn1Object.__class__.__name__,
namedType.openType.name))

for k, v in namedType.openType.items():
LOG('%s -> %r' % (k, v))

try:
openType = namedType.openType[governingValue]

Expand Down Expand Up @@ -823,7 +837,10 @@ def indefLenValueDecoder(self, substrate, asn1Spec,
openTypes = options.get('openTypes', {})

if LOG:
LOG('using open types map: %r' % openTypes)
LOG('user-specified open types map:')

for k, v in openTypes.items():
LOG('%s -> %r' % (k, v))

if openTypes or options.get('decodeOpenTypes', False):

Expand All @@ -843,6 +860,17 @@ def indefLenValueDecoder(self, substrate, asn1Spec,

except KeyError:

if LOG:
LOG('default open types map of component '
'"%s.%s" governed by component "%s.%s"'
':' % (asn1Object.__class__.__name__,
namedType.name,
asn1Object.__class__.__name__,
namedType.openType.name))

for k, v in namedType.openType.items():
LOG('%s -> %r' % (k, v))

try:
openType = namedType.openType[governingValue]

Expand Down

0 comments on commit bac135a

Please sign in to comment.