mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-23 06:31:58 +00:00
Merge pull request #4244 from ThomasWaldmann/support-msgpack060
avoid breakage with msgpack 0.6.0+, keep old limits, fixes #4220
This commit is contained in:
commit
4d29747f85
1 changed files with 28 additions and 4 deletions
|
@ -117,22 +117,46 @@ def __next__(self):
|
|||
next = __next__
|
||||
|
||||
|
||||
def unpackb(packed, *, raw=True, encoding=None, unicode_errors=None, **kwargs):
|
||||
def unpackb(packed, *, raw=True, encoding=None, unicode_errors=None,
|
||||
max_str_len=2147483647, # 2**32-1
|
||||
max_bin_len=2147483647,
|
||||
max_array_len=2147483647,
|
||||
max_map_len=2147483647,
|
||||
max_ext_len=2147483647,
|
||||
**kwargs):
|
||||
assert raw is True
|
||||
assert encoding is None
|
||||
assert unicode_errors is None
|
||||
try:
|
||||
return mp_unpackb(packed, raw=raw, encoding=encoding, unicode_errors=unicode_errors, **kwargs)
|
||||
return mp_unpackb(packed, raw=raw, encoding=encoding, unicode_errors=unicode_errors,
|
||||
max_str_len=max_str_len,
|
||||
max_bin_len=max_bin_len,
|
||||
max_array_len=max_array_len,
|
||||
max_map_len=max_map_len,
|
||||
max_ext_len=max_ext_len,
|
||||
**kwargs)
|
||||
except Exception as e:
|
||||
raise UnpackException(e)
|
||||
|
||||
|
||||
def unpack(stream, *, raw=True, encoding=None, unicode_errors=None, **kwargs):
|
||||
def unpack(stream, *, raw=True, encoding=None, unicode_errors=None,
|
||||
max_str_len=2147483647, # 2**32-1
|
||||
max_bin_len=2147483647,
|
||||
max_array_len=2147483647,
|
||||
max_map_len=2147483647,
|
||||
max_ext_len=2147483647,
|
||||
**kwargs):
|
||||
assert raw is True
|
||||
assert encoding is None
|
||||
assert unicode_errors is None
|
||||
try:
|
||||
return mp_unpack(stream, raw=raw, encoding=encoding, unicode_errors=unicode_errors, **kwargs)
|
||||
return mp_unpack(stream, raw=raw, encoding=encoding, unicode_errors=unicode_errors,
|
||||
max_str_len=max_str_len,
|
||||
max_bin_len=max_bin_len,
|
||||
max_array_len=max_array_len,
|
||||
max_map_len=max_map_len,
|
||||
max_ext_len=max_ext_len,
|
||||
**kwargs)
|
||||
except Exception as e:
|
||||
raise UnpackException(e)
|
||||
|
||||
|
|
Loading…
Reference in a new issue