summaryrefslogtreecommitdiff
path: root/pyasn1/codec/native/encoder.py
diff options
context:
space:
mode:
authorIlya Etingof <etingof@gmail.com>2019-10-03 10:28:52 +0200
committerIlya Etingof <etingof@gmail.com>2019-11-15 19:39:11 +0100
commit3fb3fcff21d65194c5774cf90042183096bb6f08 (patch)
tree7e6b86b174e05a6953b0ba54b69ab15ef24935a0 /pyasn1/codec/native/encoder.py
parentb75800d3c5b7b0996f5d19c1787106509882d212 (diff)
downloadpyasn1-git-3fb3fcff21d65194c5774cf90042183096bb6f08.tar.gz
Reuse `SingleItemDecoder` object in `StreamingDecoder`
Try to reuse `SingleItemDecoder` object to leverage its caches.
Diffstat (limited to 'pyasn1/codec/native/encoder.py')
-rw-r--r--pyasn1/codec/native/encoder.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/pyasn1/codec/native/encoder.py b/pyasn1/codec/native/encoder.py
index a3e17a9..0001916 100644
--- a/pyasn1/codec/native/encoder.py
+++ b/pyasn1/codec/native/encoder.py
@@ -225,12 +225,11 @@ class SingleItemEncoder(object):
class Encoder(object):
- SINGLE_ITEM_ENCODER = SingleItemEncoder
+ SINGLE_ITEM_ENCODER = SingleItemEncoder()
@classmethod
def __call__(cls, pyObject, asn1Spec=None, **kwargs):
- singleItemEncoder = cls.SINGLE_ITEM_ENCODER()
- return singleItemEncoder(pyObject, asn1Spec=asn1Spec, **kwargs)
+ return cls.SINGLE_ITEM_ENCODER(pyObject, asn1Spec=asn1Spec, **kwargs)
#: Turns ASN.1 object into a Python built-in type object(s).