From 0937ae90787b7a42f29818a49197e93e1301114b Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Wed, 23 Feb 2022 03:25:46 +0100 Subject: [PATCH] msgpack: require msgpack >= 1.0.3 ... and remove support code for older versions. --- setup.py | 2 +- src/borg/helpers/msgpack.py | 21 ++++++++------------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/setup.py b/setup.py index 98a844269..370e0801f 100644 --- a/setup.py +++ b/setup.py @@ -66,7 +66,7 @@ install_requires = [ # we are rather picky about msgpack versions, because a good working msgpack is # very important for borg, see: https://github.com/borgbackup/borg/issues/3753 - 'msgpack >=0.5.6, <=1.0.3, !=1.0.1', + 'msgpack >=1.0.3, <=1.0.3', # Please note: # using any other version is not supported by borg development and # any feedback related to issues caused by this will be ignored. diff --git a/src/borg/helpers/msgpack.py b/src/borg/helpers/msgpack.py index 3e2e00a63..75c98aeb3 100644 --- a/src/borg/helpers/msgpack.py +++ b/src/borg/helpers/msgpack.py @@ -30,8 +30,6 @@ version = mp_version -_post_100 = version >= (1, 0, 0) - class PackException(Exception): """Exception while msgpack packing""" @@ -99,9 +97,8 @@ def __init__(self, file_like=None, *, read_size=0, use_list=True, raw=True, max_bin_len=max_bin_len, max_array_len=max_array_len, max_map_len=max_map_len, - max_ext_len=max_ext_len) - if _post_100: - kw['strict_map_key'] = strict_map_key + max_ext_len=max_ext_len, + strict_map_key=strict_map_key) super().__init__(**kw) def unpack(self): @@ -138,10 +135,9 @@ def unpackb(packed, *, raw=True, unicode_errors=None, max_bin_len=max_bin_len, max_array_len=max_array_len, max_map_len=max_map_len, - max_ext_len=max_ext_len) + max_ext_len=max_ext_len, + strict_map_key=strict_map_key) kw.update(kwargs) - if _post_100: - kw['strict_map_key'] = strict_map_key return mp_unpackb(packed, **kw) except Exception as e: raise UnpackException(e) @@ -162,10 +158,9 @@ def unpack(stream, *, raw=True, unicode_errors=None, max_bin_len=max_bin_len, max_array_len=max_array_len, max_map_len=max_map_len, - max_ext_len=max_ext_len) + max_ext_len=max_ext_len, + strict_map_key=strict_map_key) kw.update(kwargs) - if _post_100: - kw['strict_map_key'] = strict_map_key return mp_unpack(stream, **kw) except Exception as e: raise UnpackException(e) @@ -182,8 +177,8 @@ def is_slow_msgpack(): def is_supported_msgpack(): # DO NOT CHANGE OR REMOVE! See also requirements and comments in setup.py. import msgpack - return (0, 5, 6) <= msgpack.version <= (1, 0, 3) and \ - msgpack.version not in [(1, 0, 1), ] # < add bad releases here to deny list + return (1, 0, 3) <= msgpack.version <= (1, 0, 3) and \ + msgpack.version not in [] # < add bad releases here to deny list def get_limited_unpacker(kind):