Skip to content

msgpack: Add 1.0.0 version support #167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions tarantool/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,19 @@ def __init__(self, conn, response):
# created in the __new__().
# super(Response, self).__init__()

kwargs = dict(use_list=True)
if msgpack.version >= (1, 0, 0):
# XXX: Explain why it is necessary.
kwargs['strict_map_key'] = False
if msgpack.version >= (0, 5, 2) and conn.encoding == 'utf-8':
# Get rid of the following warning.
# > PendingDeprecationWarning: encoding is deprecated,
# > Use raw=False instead.
unpacker = msgpack.Unpacker(use_list=True, raw=False)
kwargs['raw'] = False
elif conn.encoding is not None:
unpacker = msgpack.Unpacker(use_list=True, encoding=conn.encoding)
else:
unpacker = msgpack.Unpacker(use_list=True)
kwargs['encoding'] = conn.encoding

unpacker = msgpack.Unpacker(**kwargs)
unpacker.feed(response)
header = unpacker.unpack()

Expand Down