diff options
author | Ilya Etingof <etingof@gmail.com> | 2019-10-01 10:31:21 +0200 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2019-11-15 19:39:11 +0100 |
commit | b75800d3c5b7b0996f5d19c1787106509882d212 (patch) | |
tree | 65955ddc3c4db1efc5ab8b94dc92b65081ffd374 /pyasn1/codec/ber/decoder.py | |
parent | 5283ebbad9905606eb44a8daeb39da34353b3d99 (diff) | |
download | pyasn1-git-b75800d3c5b7b0996f5d19c1787106509882d212.tar.gz |
Add minor performance optimising changes
Diffstat (limited to 'pyasn1/codec/ber/decoder.py')
-rw-r--r-- | pyasn1/codec/ber/decoder.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pyasn1/codec/ber/decoder.py b/pyasn1/codec/ber/decoder.py index 8dbba5e..d9e197e 100644 --- a/pyasn1/codec/ber/decoder.py +++ b/pyasn1/codec/ber/decoder.py @@ -1471,6 +1471,9 @@ for typeDecoder in TAG_MAP.values(): stStop) = [x for x in range(10)] +EOO_SENTINEL = ints2octs((0, 0)) + + class SingleItemDecoder(object): defaultErrorState = stErrorCondition #defaultErrorState = stDumpRawValue @@ -1487,7 +1490,6 @@ class SingleItemDecoder(object): # Tag & TagSet objects caches self.__tagCache = {} self.__tagSetCache = {} - self.__eooSentinel = ints2octs((0, 0)) def __call__(self, substrate, asn1Spec=None, tagSet=None, length=None, state=stDecodeTag, @@ -1508,7 +1510,7 @@ class SingleItemDecoder(object): if isinstance(eoo_candidate, SubstrateUnderrunError): yield eoo_candidate - if eoo_candidate == self.__eooSentinel: + if eoo_candidate == EOO_SENTINEL: if LOG: LOG('end-of-octets sentinel found') yield eoo.endOfOctets |