Stop using encoding='utf-8' with msgpack

msgpack is throwing a warning that the unpacker has deprecated the use
of encoding argument. Instead the unpacker uses `raw=False`, which
does an unpack with similar behavior to the old encoding='utf-8'
mechanism.

This will reduce a lot of warning spam for projects using msgpack
such as Keystone. The change to the kwarg "raw" from "bytes_as_raw"
happned between 0.5.1 and 0.5.2. Changing the lower constraint is
required to ensure the new arguments are matching the method
signature.

Change-Id: Iadbee3ec8def9512369a415fb4603dc05d0cbc56
This commit is contained in:
Morgan 2018-05-30 14:57:05 -07:00 committed by Morgan Fainberg
parent bd10ae04a1
commit d5855294a8
3 changed files with 4 additions and 4 deletions

View File

@ -17,7 +17,7 @@ mccabe==0.2.1
mock==2.0.0 mock==2.0.0
monotonic==0.6 monotonic==0.6
mox3==0.20.0 mox3==0.20.0
msgpack==0.5.1 msgpack==0.5.2
netaddr==0.7.18 netaddr==0.7.18
netifaces==0.10.4 netifaces==0.10.4
os-client-config==1.28.0 os-client-config==1.28.0

View File

@ -446,7 +446,7 @@ def load(fp, registry=None):
# here is that the unpack() function (oddly) doesn't seem to take a # here is that the unpack() function (oddly) doesn't seem to take a
# 'ext_hook' parameter.. # 'ext_hook' parameter..
ext_hook = functools.partial(_unserializer, registry) ext_hook = functools.partial(_unserializer, registry)
return msgpack.Unpacker(fp, ext_hook=ext_hook, encoding='utf-8').unpack() return msgpack.Unpacker(fp, ext_hook=ext_hook, raw=False).unpack()
def dump(obj, fp, registry=None): def dump(obj, fp, registry=None):
@ -484,4 +484,4 @@ def loads(s, registry=None):
if registry is None: if registry is None:
registry = default_registry registry = default_registry
ext_hook = functools.partial(_unserializer, registry) ext_hook = functools.partial(_unserializer, registry)
return msgpack.unpackb(s, ext_hook=ext_hook, encoding='utf-8') return msgpack.unpackb(s, ext_hook=ext_hook, raw=False)

View File

@ -9,6 +9,6 @@
pbr!=2.1.0,>=2.0.0 # Apache-2.0 pbr!=2.1.0,>=2.0.0 # Apache-2.0
six>=1.10.0 # MIT six>=1.10.0 # MIT
msgpack>=0.5.1 # Apache-2.0 msgpack>=0.5.2 # Apache-2.0
oslo.utils>=3.33.0 # Apache-2.0 oslo.utils>=3.33.0 # Apache-2.0
pytz>=2013.6 # MIT pytz>=2013.6 # MIT