We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
upgrade cython and msgpack
is borg also affected?

https://github.com/msgpack/msgpack-python/pull/583/files

https://github.com/msgpack/msgpack-python/issues/579#issuecomment-1972893890

https://github.com/msgpack/msgpack-python/releases/tag/v1.0.8

https://github.com/cython/cython/issues/5724

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/borg/helpers/msgpack.py`
Content:
```
1 from .datastruct import StableDict
2 from ..constants import *  # NOQA
3 
4 # wrapping msgpack ---------------------------------------------------------------------------------------------------
5 #
6 # due to the breaking api changes in upstream msgpack (from 0.x to 1.0), we wrapped it the way we need it -
7 # to avoid having lots of clutter in the calling code. see tickets #968 and #3632.
8 # as borg 1.4 now requires msgpack > 1.0 anyway, the wrapper has reduced functionality, but was kept.
9 #
10 # Packing
11 # -------
12 # use_bin_type = False is needed to generate the old msgpack format (not msgpack 2.0 spec) as borg always did.
13 # unicode_errors = None is needed because usage of it is deprecated
14 #
15 # Unpacking
16 # ---------
17 # raw = True is needed to unpack the old msgpack format to bytes (not str, about the decoding see item.pyx).
18 # unicode_errors = None is needed because usage of it is deprecated
19 
20 from msgpack import Packer as mp_Packer
21 from msgpack import packb as mp_packb
22 from msgpack import pack as mp_pack
23 from msgpack import Unpacker as mp_Unpacker
24 from msgpack import unpackb as mp_unpackb
25 from msgpack import unpack as mp_unpack
26 from msgpack import version as mp_version
27 
28 from msgpack import ExtType
29 from msgpack import OutOfData
30 
31 
32 version = mp_version
33 
34 
35 class PackException(Exception):
36     """Exception while msgpack packing"""
37 
38 
39 class UnpackException(Exception):
40     """Exception while msgpack unpacking"""
41 
42 
43 class Packer(mp_Packer):
44     def __init__(self, *, default=None, unicode_errors=None,
45                  use_single_float=False, autoreset=True, use_bin_type=False,
46                  strict_types=False):
47         assert unicode_errors is None
48         super().__init__(default=default, unicode_errors=unicode_errors,
49                          use_single_float=use_single_float, autoreset=autoreset, use_bin_type=use_bin_type,
50                          strict_types=strict_types)
51 
52     def pack(self, obj):
53         try:
54             return super().pack(obj)
55         except Exception as e:
56             raise PackException(e)
57 
58 
59 def packb(o, *, use_bin_type=False, unicode_errors=None, **kwargs):
60     assert unicode_errors is None
61     try:
62         return mp_packb(o, use_bin_type=use_bin_type, unicode_errors=unicode_errors, **kwargs)
63     except Exception as e:
64         raise PackException(e)
65 
66 
67 def pack(o, stream, *, use_bin_type=False, unicode_errors=None, **kwargs):
68     assert unicode_errors is None
69     try:
70         return mp_pack(o, stream, use_bin_type=use_bin_type, unicode_errors=unicode_errors, **kwargs)
71     except Exception as e:
72         raise PackException(e)
73 
74 
75 class Unpacker(mp_Unpacker):
76     def __init__(self, file_like=None, *, read_size=0, use_list=True, raw=True,
77                  object_hook=None, object_pairs_hook=None, list_hook=None,
78                  unicode_errors=None, max_buffer_size=0,
79                  ext_hook=ExtType,
80                  strict_map_key=False):
81         assert raw is True
82         assert unicode_errors is None
83         kw = dict(file_like=file_like, read_size=read_size, use_list=use_list, raw=raw,
84                   object_hook=object_hook, object_pairs_hook=object_pairs_hook, list_hook=list_hook,
85                   unicode_errors=unicode_errors, max_buffer_size=max_buffer_size,
86                   ext_hook=ext_hook,
87                   strict_map_key=strict_map_key)
88         super().__init__(**kw)
89 
90     def unpack(self):
91         try:
92             return super().unpack()
93         except OutOfData:
94             raise
95         except Exception as e:
96             raise UnpackException(e)
97 
98     def __next__(self):
99         try:
100             return super().__next__()
101         except StopIteration:
102             raise
103         except Exception as e:
104             raise UnpackException(e)
105 
106     next = __next__
107 
108 
109 def unpackb(packed, *, raw=True, unicode_errors=None, strict_map_key=False, **kwargs):
110     assert unicode_errors is None
111     try:
112         kw = dict(raw=raw, unicode_errors=unicode_errors, strict_map_key=strict_map_key)
113         kw.update(kwargs)
114         return mp_unpackb(packed, **kw)
115     except Exception as e:
116         raise UnpackException(e)
117 
118 
119 def unpack(stream, *, raw=True, unicode_errors=None, strict_map_key=False, **kwargs):
120     assert unicode_errors is None
121     try:
122         kw = dict(raw=raw, unicode_errors=unicode_errors, strict_map_key=strict_map_key)
123         kw.update(kwargs)
124         return mp_unpack(stream, **kw)
125     except Exception as e:
126         raise UnpackException(e)
127 
128 
129 # msgpacking related utilities -----------------------------------------------
130 
131 def is_slow_msgpack():
132     import msgpack
133     import msgpack.fallback
134     return msgpack.Packer is msgpack.fallback.Packer
135 
136 
137 def is_supported_msgpack():
138     # DO NOT CHANGE OR REMOVE! See also requirements and comments in pyproject.toml.
139     import msgpack
140     return (1, 0, 3) <= msgpack.version <= (1, 0, 7) and \
141            msgpack.version not in []  # < add bad releases here to deny list
142 
143 
144 def get_limited_unpacker(kind):
145     """return a limited Unpacker because we should not trust msgpack data received from remote"""
146     # Note: msgpack >= 0.6.1 auto-computes DoS-safe max values from len(data) for
147     #       unpack(data) or from max_buffer_size for Unpacker(max_buffer_size=N).
148     args = dict(use_list=False, max_buffer_size=3 * max(BUFSIZE, MAX_OBJECT_SIZE))  # return tuples, not lists
149     if kind in ('server', 'client'):
150         pass  # nothing special
151     elif kind in ('manifest', 'archive', 'key'):
152         args.update(dict(use_list=True, object_hook=StableDict))  # default value
153     else:
154         raise ValueError('kind must be "server", "client", "manifest", "archive" or "key"')
155     return Unpacker(**args)
156 
157 
158 def bigint_to_int(mtime):
159     """Convert bytearray to int
160     """
161     if isinstance(mtime, bytes):
162         return int.from_bytes(mtime, 'little', signed=True)
163     return mtime
164 
165 
166 def int_to_bigint(value):
167     """Convert integers larger than 64 bits to bytearray
168 
169     Smaller integers are left alone
170     """
171     if value.bit_length() > 63:
172         return value.to_bytes((value.bit_length() + 9) // 8, 'little', signed=True)
173     return value
174
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/borg/helpers/msgpack.py b/src/borg/helpers/msgpack.py
--- a/src/borg/helpers/msgpack.py
+++ b/src/borg/helpers/msgpack.py
@@ -137,7 +137,7 @@
 def is_supported_msgpack():
     # DO NOT CHANGE OR REMOVE! See also requirements and comments in pyproject.toml.
     import msgpack
-    return (1, 0, 3) <= msgpack.version <= (1, 0, 7) and \
+    return (1, 0, 3) <= msgpack.version <= (1, 0, 8) and \
            msgpack.version not in []  # < add bad releases here to deny list

{"golden_diff": "diff --git a/src/borg/helpers/msgpack.py b/src/borg/helpers/msgpack.py\n--- a/src/borg/helpers/msgpack.py\n+++ b/src/borg/helpers/msgpack.py\n@@ -137,7 +137,7 @@\n def is_supported_msgpack():\n     # DO NOT CHANGE OR REMOVE! See also requirements and comments in pyproject.toml.\n     import msgpack\n-    return (1, 0, 3) <= msgpack.version <= (1, 0, 7) and \\\n+    return (1, 0, 3) <= msgpack.version <= (1, 0, 8) and \\\n            msgpack.version not in []  # < add bad releases here to deny list\n", "issue": "upgrade cython and msgpack\nis borg also affected?\r\n\r\nhttps://github.com/msgpack/msgpack-python/pull/583/files\r\n\r\nhttps://github.com/msgpack/msgpack-python/issues/579#issuecomment-1972893890\r\n\r\nhttps://github.com/msgpack/msgpack-python/releases/tag/v1.0.8\r\n\r\nhttps://github.com/cython/cython/issues/5724\n", "before_files": [{"content": "from .datastruct import StableDict\nfrom ..constants import *  # NOQA\n\n# wrapping msgpack ---------------------------------------------------------------------------------------------------\n#\n# due to the breaking api changes in upstream msgpack (from 0.x to 1.0), we wrapped it the way we need it -\n# to avoid having lots of clutter in the calling code. see tickets #968 and #3632.\n# as borg 1.4 now requires msgpack > 1.0 anyway, the wrapper has reduced functionality, but was kept.\n#\n# Packing\n# -------\n# use_bin_type = False is needed to generate the old msgpack format (not msgpack 2.0 spec) as borg always did.\n# unicode_errors = None is needed because usage of it is deprecated\n#\n# Unpacking\n# ---------\n# raw = True is needed to unpack the old msgpack format to bytes (not str, about the decoding see item.pyx).\n# unicode_errors = None is needed because usage of it is deprecated\n\nfrom msgpack import Packer as mp_Packer\nfrom msgpack import packb as mp_packb\nfrom msgpack import pack as mp_pack\nfrom msgpack import Unpacker as mp_Unpacker\nfrom msgpack import unpackb as mp_unpackb\nfrom msgpack import unpack as mp_unpack\nfrom msgpack import version as mp_version\n\nfrom msgpack import ExtType\nfrom msgpack import OutOfData\n\n\nversion = mp_version\n\n\nclass PackException(Exception):\n    \"\"\"Exception while msgpack packing\"\"\"\n\n\nclass UnpackException(Exception):\n    \"\"\"Exception while msgpack unpacking\"\"\"\n\n\nclass Packer(mp_Packer):\n    def __init__(self, *, default=None, unicode_errors=None,\n                 use_single_float=False, autoreset=True, use_bin_type=False,\n                 strict_types=False):\n        assert unicode_errors is None\n        super().__init__(default=default, unicode_errors=unicode_errors,\n                         use_single_float=use_single_float, autoreset=autoreset, use_bin_type=use_bin_type,\n                         strict_types=strict_types)\n\n    def pack(self, obj):\n        try:\n            return super().pack(obj)\n        except Exception as e:\n            raise PackException(e)\n\n\ndef packb(o, *, use_bin_type=False, unicode_errors=None, **kwargs):\n    assert unicode_errors is None\n    try:\n        return mp_packb(o, use_bin_type=use_bin_type, unicode_errors=unicode_errors, **kwargs)\n    except Exception as e:\n        raise PackException(e)\n\n\ndef pack(o, stream, *, use_bin_type=False, unicode_errors=None, **kwargs):\n    assert unicode_errors is None\n    try:\n        return mp_pack(o, stream, use_bin_type=use_bin_type, unicode_errors=unicode_errors, **kwargs)\n    except Exception as e:\n        raise PackException(e)\n\n\nclass Unpacker(mp_Unpacker):\n    def __init__(self, file_like=None, *, read_size=0, use_list=True, raw=True,\n                 object_hook=None, object_pairs_hook=None, list_hook=None,\n                 unicode_errors=None, max_buffer_size=0,\n                 ext_hook=ExtType,\n                 strict_map_key=False):\n        assert raw is True\n        assert unicode_errors is None\n        kw = dict(file_like=file_like, read_size=read_size, use_list=use_list, raw=raw,\n                  object_hook=object_hook, object_pairs_hook=object_pairs_hook, list_hook=list_hook,\n                  unicode_errors=unicode_errors, max_buffer_size=max_buffer_size,\n                  ext_hook=ext_hook,\n                  strict_map_key=strict_map_key)\n        super().__init__(**kw)\n\n    def unpack(self):\n        try:\n            return super().unpack()\n        except OutOfData:\n            raise\n        except Exception as e:\n            raise UnpackException(e)\n\n    def __next__(self):\n        try:\n            return super().__next__()\n        except StopIteration:\n            raise\n        except Exception as e:\n            raise UnpackException(e)\n\n    next = __next__\n\n\ndef unpackb(packed, *, raw=True, unicode_errors=None, strict_map_key=False, **kwargs):\n    assert unicode_errors is None\n    try:\n        kw = dict(raw=raw, unicode_errors=unicode_errors, strict_map_key=strict_map_key)\n        kw.update(kwargs)\n        return mp_unpackb(packed, **kw)\n    except Exception as e:\n        raise UnpackException(e)\n\n\ndef unpack(stream, *, raw=True, unicode_errors=None, strict_map_key=False, **kwargs):\n    assert unicode_errors is None\n    try:\n        kw = dict(raw=raw, unicode_errors=unicode_errors, strict_map_key=strict_map_key)\n        kw.update(kwargs)\n        return mp_unpack(stream, **kw)\n    except Exception as e:\n        raise UnpackException(e)\n\n\n# msgpacking related utilities -----------------------------------------------\n\ndef is_slow_msgpack():\n    import msgpack\n    import msgpack.fallback\n    return msgpack.Packer is msgpack.fallback.Packer\n\n\ndef is_supported_msgpack():\n    # DO NOT CHANGE OR REMOVE! See also requirements and comments in pyproject.toml.\n    import msgpack\n    return (1, 0, 3) <= msgpack.version <= (1, 0, 7) and \\\n           msgpack.version not in []  # < add bad releases here to deny list\n\n\ndef get_limited_unpacker(kind):\n    \"\"\"return a limited Unpacker because we should not trust msgpack data received from remote\"\"\"\n    # Note: msgpack >= 0.6.1 auto-computes DoS-safe max values from len(data) for\n    #       unpack(data) or from max_buffer_size for Unpacker(max_buffer_size=N).\n    args = dict(use_list=False, max_buffer_size=3 * max(BUFSIZE, MAX_OBJECT_SIZE))  # return tuples, not lists\n    if kind in ('server', 'client'):\n        pass  # nothing special\n    elif kind in ('manifest', 'archive', 'key'):\n        args.update(dict(use_list=True, object_hook=StableDict))  # default value\n    else:\n        raise ValueError('kind must be \"server\", \"client\", \"manifest\", \"archive\" or \"key\"')\n    return Unpacker(**args)\n\n\ndef bigint_to_int(mtime):\n    \"\"\"Convert bytearray to int\n    \"\"\"\n    if isinstance(mtime, bytes):\n        return int.from_bytes(mtime, 'little', signed=True)\n    return mtime\n\n\ndef int_to_bigint(value):\n    \"\"\"Convert integers larger than 64 bits to bytearray\n\n    Smaller integers are left alone\n    \"\"\"\n    if value.bit_length() > 63:\n        return value.to_bytes((value.bit_length() + 9) // 8, 'little', signed=True)\n    return value\n", "path": "src/borg/helpers/msgpack.py"}], "after_files": [{"content": "from .datastruct import StableDict\nfrom ..constants import *  # NOQA\n\n# wrapping msgpack ---------------------------------------------------------------------------------------------------\n#\n# due to the breaking api changes in upstream msgpack (from 0.x to 1.0), we wrapped it the way we need it -\n# to avoid having lots of clutter in the calling code. see tickets #968 and #3632.\n# as borg 1.4 now requires msgpack > 1.0 anyway, the wrapper has reduced functionality, but was kept.\n#\n# Packing\n# -------\n# use_bin_type = False is needed to generate the old msgpack format (not msgpack 2.0 spec) as borg always did.\n# unicode_errors = None is needed because usage of it is deprecated\n#\n# Unpacking\n# ---------\n# raw = True is needed to unpack the old msgpack format to bytes (not str, about the decoding see item.pyx).\n# unicode_errors = None is needed because usage of it is deprecated\n\nfrom msgpack import Packer as mp_Packer\nfrom msgpack import packb as mp_packb\nfrom msgpack import pack as mp_pack\nfrom msgpack import Unpacker as mp_Unpacker\nfrom msgpack import unpackb as mp_unpackb\nfrom msgpack import unpack as mp_unpack\nfrom msgpack import version as mp_version\n\nfrom msgpack import ExtType\nfrom msgpack import OutOfData\n\n\nversion = mp_version\n\n\nclass PackException(Exception):\n    \"\"\"Exception while msgpack packing\"\"\"\n\n\nclass UnpackException(Exception):\n    \"\"\"Exception while msgpack unpacking\"\"\"\n\n\nclass Packer(mp_Packer):\n    def __init__(self, *, default=None, unicode_errors=None,\n                 use_single_float=False, autoreset=True, use_bin_type=False,\n                 strict_types=False):\n        assert unicode_errors is None\n        super().__init__(default=default, unicode_errors=unicode_errors,\n                         use_single_float=use_single_float, autoreset=autoreset, use_bin_type=use_bin_type,\n                         strict_types=strict_types)\n\n    def pack(self, obj):\n        try:\n            return super().pack(obj)\n        except Exception as e:\n            raise PackException(e)\n\n\ndef packb(o, *, use_bin_type=False, unicode_errors=None, **kwargs):\n    assert unicode_errors is None\n    try:\n        return mp_packb(o, use_bin_type=use_bin_type, unicode_errors=unicode_errors, **kwargs)\n    except Exception as e:\n        raise PackException(e)\n\n\ndef pack(o, stream, *, use_bin_type=False, unicode_errors=None, **kwargs):\n    assert unicode_errors is None\n    try:\n        return mp_pack(o, stream, use_bin_type=use_bin_type, unicode_errors=unicode_errors, **kwargs)\n    except Exception as e:\n        raise PackException(e)\n\n\nclass Unpacker(mp_Unpacker):\n    def __init__(self, file_like=None, *, read_size=0, use_list=True, raw=True,\n                 object_hook=None, object_pairs_hook=None, list_hook=None,\n                 unicode_errors=None, max_buffer_size=0,\n                 ext_hook=ExtType,\n                 strict_map_key=False):\n        assert raw is True\n        assert unicode_errors is None\n        kw = dict(file_like=file_like, read_size=read_size, use_list=use_list, raw=raw,\n                  object_hook=object_hook, object_pairs_hook=object_pairs_hook, list_hook=list_hook,\n                  unicode_errors=unicode_errors, max_buffer_size=max_buffer_size,\n                  ext_hook=ext_hook,\n                  strict_map_key=strict_map_key)\n        super().__init__(**kw)\n\n    def unpack(self):\n        try:\n            return super().unpack()\n        except OutOfData:\n            raise\n        except Exception as e:\n            raise UnpackException(e)\n\n    def __next__(self):\n        try:\n            return super().__next__()\n        except StopIteration:\n            raise\n        except Exception as e:\n            raise UnpackException(e)\n\n    next = __next__\n\n\ndef unpackb(packed, *, raw=True, unicode_errors=None, strict_map_key=False, **kwargs):\n    assert unicode_errors is None\n    try:\n        kw = dict(raw=raw, unicode_errors=unicode_errors, strict_map_key=strict_map_key)\n        kw.update(kwargs)\n        return mp_unpackb(packed, **kw)\n    except Exception as e:\n        raise UnpackException(e)\n\n\ndef unpack(stream, *, raw=True, unicode_errors=None, strict_map_key=False, **kwargs):\n    assert unicode_errors is None\n    try:\n        kw = dict(raw=raw, unicode_errors=unicode_errors, strict_map_key=strict_map_key)\n        kw.update(kwargs)\n        return mp_unpack(stream, **kw)\n    except Exception as e:\n        raise UnpackException(e)\n\n\n# msgpacking related utilities -----------------------------------------------\n\ndef is_slow_msgpack():\n    import msgpack\n    import msgpack.fallback\n    return msgpack.Packer is msgpack.fallback.Packer\n\n\ndef is_supported_msgpack():\n    # DO NOT CHANGE OR REMOVE! See also requirements and comments in pyproject.toml.\n    import msgpack\n    return (1, 0, 3) <= msgpack.version <= (1, 0, 8) and \\\n           msgpack.version not in []  # < add bad releases here to deny list\n\n\ndef get_limited_unpacker(kind):\n    \"\"\"return a limited Unpacker because we should not trust msgpack data received from remote\"\"\"\n    # Note: msgpack >= 0.6.1 auto-computes DoS-safe max values from len(data) for\n    #       unpack(data) or from max_buffer_size for Unpacker(max_buffer_size=N).\n    args = dict(use_list=False, max_buffer_size=3 * max(BUFSIZE, MAX_OBJECT_SIZE))  # return tuples, not lists\n    if kind in ('server', 'client'):\n        pass  # nothing special\n    elif kind in ('manifest', 'archive', 'key'):\n        args.update(dict(use_list=True, object_hook=StableDict))  # default value\n    else:\n        raise ValueError('kind must be \"server\", \"client\", \"manifest\", \"archive\" or \"key\"')\n    return Unpacker(**args)\n\n\ndef bigint_to_int(mtime):\n    \"\"\"Convert bytearray to int\n    \"\"\"\n    if isinstance(mtime, bytes):\n        return int.from_bytes(mtime, 'little', signed=True)\n    return mtime\n\n\ndef int_to_bigint(value):\n    \"\"\"Convert integers larger than 64 bits to bytearray\n\n    Smaller integers are left alone\n    \"\"\"\n    if value.bit_length() > 63:\n        return value.to_bytes((value.bit_length() + 9) // 8, 'little', signed=True)\n    return value\n", "path": "src/borg/helpers/msgpack.py"}]}