msgpack: require msgpack >= 1.0.3

... and remove support code for older versions.
This commit is contained in:
Thomas Waldmann 2022-02-23 03:25:46 +01:00
parent 9e669f6db8
commit 0937ae9078
2 changed files with 9 additions and 14 deletions

View File

@ -66,7 +66,7 @@ on_rtd = os.environ.get('READTHEDOCS')
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.

View File

@ -30,8 +30,6 @@ from msgpack import OutOfData
version = mp_version
_post_100 = version >= (1, 0, 0)
class PackException(Exception):
"""Exception while msgpack packing"""
@ -99,9 +97,8 @@ class Unpacker(mp_Unpacker):
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):