Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pyasn1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenVMS
Python
Modules
pyasn1
Commits
a9aad6c2985d
Commit
a9aad6c2985d
authored
5 years ago
by
Ilya Etingof
Browse files
Options
Downloads
Patches
Plain Diff
Add minor performance optimising changes
parent
375c2ef9d9d3
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pyasn1/codec/ber/decoder.py
+4
-2
4 additions, 2 deletions
pyasn1/codec/ber/decoder.py
pyasn1/codec/streaming.py
+5
-2
5 additions, 2 deletions
pyasn1/codec/streaming.py
with
9 additions
and
4 deletions
pyasn1/codec/ber/decoder.py
+
4
−
2
View file @
a9aad6c2
...
@@ -1471,6 +1471,9 @@
...
@@ -1471,6 +1471,9 @@
stStop
)
=
[
x
for
x
in
range
(
10
)]
stStop
)
=
[
x
for
x
in
range
(
10
)]
EOO_SENTINEL
=
ints2octs
((
0
,
0
))
class
SingleItemDecoder
(
object
):
class
SingleItemDecoder
(
object
):
defaultErrorState
=
stErrorCondition
defaultErrorState
=
stErrorCondition
#defaultErrorState = stDumpRawValue
#defaultErrorState = stDumpRawValue
...
@@ -1487,7 +1490,6 @@
...
@@ -1487,7 +1490,6 @@
# Tag & TagSet objects caches
# Tag & TagSet objects caches
self
.
__tagCache
=
{}
self
.
__tagCache
=
{}
self
.
__tagSetCache
=
{}
self
.
__tagSetCache
=
{}
self
.
__eooSentinel
=
ints2octs
((
0
,
0
))
def
__call__
(
self
,
substrate
,
asn1Spec
=
None
,
def
__call__
(
self
,
substrate
,
asn1Spec
=
None
,
tagSet
=
None
,
length
=
None
,
state
=
stDecodeTag
,
tagSet
=
None
,
length
=
None
,
state
=
stDecodeTag
,
...
@@ -1508,7 +1510,7 @@
...
@@ -1508,7 +1510,7 @@
if
isinstance
(
eoo_candidate
,
SubstrateUnderrunError
):
if
isinstance
(
eoo_candidate
,
SubstrateUnderrunError
):
yield
eoo_candidate
yield
eoo_candidate
if
eoo_candidate
==
self
.
__eooSentinel
:
if
eoo_candidate
==
EOO_SENTINEL
:
if
LOG
:
if
LOG
:
LOG
(
'
end-of-octets sentinel found
'
)
LOG
(
'
end-of-octets sentinel found
'
)
yield
eoo
.
endOfOctets
yield
eoo
.
endOfOctets
...
...
This diff is collapsed.
Click to expand it.
pyasn1/codec/streaming.py
+
5
−
2
View file @
a9aad6c2
...
@@ -98,7 +98,10 @@
...
@@ -98,7 +98,10 @@
: :py:class:`~pyasn1.error.PyAsn1Error`
: :py:class:`~pyasn1.error.PyAsn1Error`
If the supplied substrate cannot be converted to a seekable stream.
If the supplied substrate cannot be converted to a seekable stream.
"""
"""
if
isinstance
(
substrate
,
bytes
):
if
isinstance
(
substrate
,
io
.
BytesIO
):
return
substrate
elif
isinstance
(
substrate
,
bytes
):
return
io
.
BytesIO
(
substrate
)
return
io
.
BytesIO
(
substrate
)
elif
isinstance
(
substrate
,
univ
.
OctetString
):
elif
isinstance
(
substrate
,
univ
.
OctetString
):
...
@@ -225,7 +228,7 @@
...
@@ -225,7 +228,7 @@
if
received
is
None
:
# non-blocking stream can do this
if
received
is
None
:
# non-blocking stream can do this
yield
error
.
SubstrateUnderrunError
(
context
=
context
)
yield
error
.
SubstrateUnderrunError
(
context
=
context
)
elif
size
!=
0
and
not
received
:
# end-of-stream
elif
not
received
and
size
!=
0
:
# end-of-stream
raise
error
.
EndOfStreamError
(
context
=
context
)
raise
error
.
EndOfStreamError
(
context
=
context
)
elif
len
(
received
)
<
size
:
elif
len
(
received
)
<
size
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment