From d5855294a891b91a6c87977128b19b9bb0588f87 Mon Sep 17 00:00:00 2001 From: Morgan Date: Wed, 30 May 2018 14:57:05 -0700 Subject: [PATCH] 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 --- lower-constraints.txt | 2 +- oslo_serialization/msgpackutils.py | 4 ++-- requirements.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lower-constraints.txt b/lower-constraints.txt index 4791fab..d2a212f 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -17,7 +17,7 @@ mccabe==0.2.1 mock==2.0.0 monotonic==0.6 mox3==0.20.0 -msgpack==0.5.1 +msgpack==0.5.2 netaddr==0.7.18 netifaces==0.10.4 os-client-config==1.28.0 diff --git a/oslo_serialization/msgpackutils.py b/oslo_serialization/msgpackutils.py index 4206ab4..d9a82ea 100644 --- a/oslo_serialization/msgpackutils.py +++ b/oslo_serialization/msgpackutils.py @@ -446,7 +446,7 @@ def load(fp, registry=None): # here is that the unpack() function (oddly) doesn't seem to take a # 'ext_hook' parameter.. 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): @@ -484,4 +484,4 @@ def loads(s, registry=None): if registry is None: registry = default_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) diff --git a/requirements.txt b/requirements.txt index 25e2a76..abdd118 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,6 +9,6 @@ pbr!=2.1.0,>=2.0.0 # Apache-2.0 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 pytz>=2013.6 # MIT