Release 0.4.6
This release brings support for one overlooked ASN.1 feature:
- Added previously missing
SET OF ANY
construct encoding/decoding support.
As a consequence, SequenceOf
/SetOf
objects behavior has been made closer to Python list and more consistent with the rest of pyasn1 types (at the expense of potential backward compatibility issues):
- New elements to
SequenceOf
/SetOf
objects can now be added at any
position - the requirement for the new elements to reside at the end
of the existing ones (i.e. s[len(s)] = 123) is removed. - List-like slicing support added to
SequenceOf
/SetOf
objects. - Removed default initializer from
SequenceOf
/SetOf
types to ensure
consistent behaviour with the rest of ASN.1 types. Before this change,
SequenceOf
/SetOf
instances immediately become value objects behaving
like an empty list. With this change,SequenceOf
/SetOf
objects
remain schema objects unless a component is added or.clear()
is
called.
This change can potentially cause incompatibilities with existing
pyasn1 objects which assumeSequenceOf
/SetOf
instances are value
objects right upon instantiation.
The behaviour ofSequence
/Set
types depends on thecomponentType
initializer: if nocomponentType
is given, the behavior is the
same asSequenceOf
/SetOf
have. IfcomponentType
is given, but
neither optional nor defaulted components are present, created
instance remains being the schema object. If, however, either optional or
defaulted component is present, created instance immediately
becomes a value object. - Added
.reset()
method to all constructed types to turn value object
into a schema object.
Also, a couple of minor usability improvements:
- Added
omitEmptyOptionals
option which is respected bySequence
andSet
encoders. WhenomitEmptyOptionals
is set toTrue
, empty
initialized optional components are not encoded. Default isFalse
. - Added
PyAsn1UnicodeDecodeError
/PyAsn1UnicodeDecodeError
exceptions
to help the caller treating unicode errors happening internally
to pyasn1 at the upper layers. - Added support for subseconds CER/DER encoding edge cases in
GeneralizedTime
codec.
And, of course, bug fixes \o/
- Fixed 3-digit fractional seconds value CER/DER encoding of
GeneralizedTime
. - Fixed
AnyDecoder
to accept possibleTagMap
asasn1Spec
to make dumping raw value operational
Complete list of changes can be found in CHANGELOG.