• Robin Obůrka's avatar
    msgpack: Fix compatibilty issues · 7034e36b
    Robin Obůrka authored
    The messagepack history started in days when unicode, string, and bytes
    (or binary data types) were not distingushed in Python. All string data was
    packed as string - and also unpacked.
    
    This changed with Python2 which introduced Unicode - marked as u"Unicode string".
    (The default string remained unmarked or possibly marked as bytes
    "default string"=b"default string".)
    
    Python3 then switched its default string directly to Unicode. ("Unicode
    string"=u"Unicode string". Bytes remained marked as b"bytes string")
    
    To solve this, two logical parametres were
    introduced to messagepack - one for packer and the other one for unpacker:
    
    * use_bin_type
        - packer
        - default before 1.0: `False`
        - default after 1.0: `True`
        - when set, the packer distinguish between unicode(raw) and bytes(bin)
        - when unset, the packer doesnt distinguish between unicode and bytes and
          packs everything as internal "raw"
    
    * raw
        - unpacker
        - default before 1.0: `True`
        - default after 1.0: `False`
        - when set, the unpacker doesnt respect internal data types and transforms
          everything either to  bytes when `use_bin_type` is set or to
          unicode when it is not set
        - when unset, the unpacker respects internal data types and transforms
          "internal bin" to bytest and "internal raw" to unicode
    
    Default values before 1.0 were set to be compatible with old versions
    that threats everything as "raw" (ASCII) string. So everything was
    packed as "raw" (nothing as "bin") and everythong unpacked as (Unicode)
    string.
    
    Default values after 1.0 ensure that everything is unpacked as the same
    type as it was packed.
    
    The stable version is 0.6.0 right now. Here is a compatibility list of
    previous versions:
    
    * Version 0.6.0 - compatible
        - needs catching of `Value Error` in `parse_msg`
    * Version 0.5.6 - compatible
    * Version 0.5.5 - compatible
    * Version 0.5.4 - compatible
    * Version 0.5.3 - compatible
        - deprecated (uses some deprecated internals)
    * Version 0.5.2 - compatible
        - deprecated (uses some deprecated internals)
    * Version 0.5.1 - incompatible
        - unknown keyword "raw" in unpack(raw=...)
    7034e36b
Name
Last commit
Last update
..
argparser Loading commit data...
messages Loading commit data...
msgloop Loading commit data...
network Loading commit data...
__init__.py Loading commit data...
conftest.py Loading commit data...