summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Pipek <jan.pipek@gmail.com>2019-09-10 15:08:08 +0200
committerIlya Etingof <etingof@gmail.com>2019-11-15 19:31:42 +0100
commit3c5ebb96df4238f81439ae05ca20b5fe3936aab4 (patch)
tree2f0fe1b30f17c0f3b2a2cba055e8143728eb015c
parent3cf920db9e1c41fe5c4b834a263d3e0fe06e4440 (diff)
downloadpyasn1-git-3c5ebb96df4238f81439ae05ca20b5fe3936aab4.tar.gz
Trivial changes from the MR.
-rw-r--r--pyasn1/codec/ber/decoder.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/pyasn1/codec/ber/decoder.py b/pyasn1/codec/ber/decoder.py
index 3c7473c..edb0bf9 100644
--- a/pyasn1/codec/ber/decoder.py
+++ b/pyasn1/codec/ber/decoder.py
@@ -64,7 +64,7 @@ def endOfStream(substrate):
if isinstance(substrate, BytesIO):
cp = substrate.tell()
substrate.seek(0, os.SEEK_END)
- result = not(substrate.tell() - cp)
+ result = substrate.tell() == cp
substrate.seek(cp, os.SEEK_SET)
return result
else:
@@ -183,7 +183,7 @@ class IntegerDecoder(AbstractSimpleDecoder):
raise error.PyAsn1Error('Simple tag format expected')
the_bytes = substrate.read(length)
- if len(the_bytes) == 0:
+ if not the_bytes:
return self._createComponent(asn1Spec, tagSet, 0, **options)
value = from_bytes(the_bytes, signed=True)
@@ -212,7 +212,7 @@ class BitStringDecoder(AbstractSimpleDecoder):
return substrateFun(self._createComponent(
asn1Spec, tagSet, noValue, **options), substrate, length)
- if endOfStream(substrate) or not length:
+ if not length or endOfStream(substrate):
raise error.PyAsn1Error('Empty BIT STRING substrate')
if tagSet[0].tagFormat == tag.tagFormatSimple: # XXX what tag to check?