Skip to content

Conversation

@nresare
Copy link

@nresare nresare commented Oct 7, 2014

According to the spec "serializers SHOULD use the format which
represents the data in the smallest number of bytes". This is not true
for strings between 32 and (2^8)-1 bytes which has an encoding
overhead of 3 bytes instead of the required 2.

My guess is that the somewhat strange conditional in fallback.py:598
(and cython equivalent) is to make sure that old raw type test
cases in test_case.py that test for encoding overhead succeeds.

This commit updates the test case to test for the encoding overhead
for both str and bin types of various lengths.

According to the spec "serializers SHOULD use the format which
represents the data in the smallest number of bytes". This is not true
for strings between 32 and (2^8)-1 bytes which has an encoding
overhead of 3 bytes instead of the required 2.

My guess is that the somewhat strange conditional in fallback.py:598
(and cython equivalent) is to make sure that old raw type test
cases in test_case.py that test for encoding overhead succeeds.

This commit updates the test case to test for the encoding overhead
for both str and bin types of various lengths.
@methane
Copy link
Member

methane commented Oct 10, 2014

str8 is introduced later with bin types.
Old unpackers can't unpack recognize str8 type.
You can use it with use_bin=True option.

See also: msgpack/msgpack#183

@methane methane closed this Oct 10, 2014
@nresare
Copy link
Author

nresare commented Oct 15, 2014

@methane I think that this patch is indicative of a communication problem that msgpack has with new arrivals to the community. (It is somewhat ironic that you reference the spec rewording that I myself wrote, after having understood what the old one meant)

I needed an efficient simple data serialisation format, and based on the information on msgpack.org I assumed that the referenced spec was what the various implementations would implement. This is not the case, and figuring that out requires a lot of digging.

When can we expect a major version upgrade of the python implementation, that implements the spec as written?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants