Skip to content

Commit

Permalink
enable binary type for msgpack
Browse files Browse the repository at this point in the history
  • Loading branch information
serge-name committed Jul 16, 2021
1 parent ea942f9 commit 8357edb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,6 @@ def find_version(*file_paths):
cmdclass=cmdclass,
command_options=command_options,
install_requires=[
'msgpack>=0.4.0',
'msgpack>=1.0.0',
]
)
26 changes: 1 addition & 25 deletions tarantool/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,31 +76,7 @@ def __init__(self, conn):
self._sync = None
self._body = ''
self.response_class = Response

packer_kwargs = dict()

# use_bin_type=True is default since msgpack-1.0.0.
#
# The option controls whether to pack binary (non-unicode)
# string values as mp_bin or as mp_str.
#
# The default behaviour of the connector is to pack both
# bytes and Unicode strings as mp_str.
#
# msgpack-0.5.0 (and only this version) warns when the
# option is unset:
#
# | FutureWarning: use_bin_type option is not specified.
# | Default value of the option will be changed in future
# | version.
#
# The option is supported since msgpack-0.4.0, so we can
# just always set it for all msgpack versions to get rid
# of the warning on msgpack-0.5.0 and to keep our
# behaviour on msgpack-1.0.0.
packer_kwargs['use_bin_type'] = False

self.packer = msgpack.Packer(**packer_kwargs)
self.packer = msgpack.Packer()

def _dumps(self, src):
return self.packer.pack(src)
Expand Down

0 comments on commit 8357edb

Please sign in to comment.