Skip to content

Release 0.4.6

Compare
Choose a tag to compare
@etingof etingof released this 31 Jul 19:50
· 75 commits to master since this release

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 assume SequenceOf/SetOf instances are value
    objects right upon instantiation.
    The behaviour of Sequence/Set types depends on the componentType
    initializer: if no componentType is given, the behavior is the
    same as SequenceOf/SetOf have. If componentType 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 by Sequence
    and Set encoders. When omitEmptyOptionals is set to True, empty
    initialized optional components are not encoded. Default is False.
  • 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 possible TagMap as asn1Spec
    to make dumping raw value operational

Complete list of changes can be found in CHANGELOG.