Skip to content

Commit f341a3b

Browse files
committed
Upgrade msgpack to 1.0.4
1 parent fd0ea6b commit f341a3b

File tree

6 files changed

+18
-17
lines changed

6 files changed

+18
-17
lines changed

news/msgpack.vendor.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Upgrade msgpack to 1.0.4

src/pip/_vendor/msgpack/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
# coding: utf-8
2-
from ._version import version
32
from .exceptions import *
43
from .ext import ExtType, Timestamp
54

65
import os
76
import sys
87

98

9+
version = (1, 0, 4)
10+
__version__ = "1.0.4"
11+
12+
1013
if os.environ.get("MSGPACK_PUREPYTHON") or sys.version_info[0] == 2:
1114
from .fallback import Packer, unpackb, Unpacker
1215
else:

src/pip/_vendor/msgpack/_version.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/pip/_vendor/msgpack/ext.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def __init__(self, seconds, nanoseconds=0):
5959
raise TypeError("seconds must be an interger")
6060
if not isinstance(nanoseconds, int_types):
6161
raise TypeError("nanoseconds must be an integer")
62-
if not (0 <= nanoseconds < 10 ** 9):
62+
if not (0 <= nanoseconds < 10**9):
6363
raise ValueError(
6464
"nanoseconds must be a non-negative integer less than 999999999."
6565
)
@@ -143,7 +143,7 @@ def from_unix(unix_sec):
143143
:type unix_float: int or float.
144144
"""
145145
seconds = int(unix_sec // 1)
146-
nanoseconds = int((unix_sec % 1) * 10 ** 9)
146+
nanoseconds = int((unix_sec % 1) * 10**9)
147147
return Timestamp(seconds, nanoseconds)
148148

149149
def to_unix(self):
@@ -161,15 +161,15 @@ def from_unix_nano(unix_ns):
161161
:param int unix_ns: Posix timestamp in nanoseconds.
162162
:rtype: Timestamp
163163
"""
164-
return Timestamp(*divmod(unix_ns, 10 ** 9))
164+
return Timestamp(*divmod(unix_ns, 10**9))
165165

166166
def to_unix_nano(self):
167167
"""Get the timestamp as a unixtime in nanoseconds.
168168
169169
:returns: posix timestamp in nanoseconds
170170
:rtype: int
171171
"""
172-
return self.seconds * 10 ** 9 + self.nanoseconds
172+
return self.seconds * 10**9 + self.nanoseconds
173173

174174
def to_datetime(self):
175175
"""Get the timestamp as a UTC datetime.

src/pip/_vendor/msgpack/fallback.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
def dict_iteritems(d):
1212
return d.iteritems()
1313

14-
1514
else:
1615
int_types = int
1716
unicode = str
@@ -32,7 +31,6 @@ def _is_recursionerror(e):
3231
and e.args[0].startswith("maximum recursion depth exceeded")
3332
)
3433

35-
3634
else:
3735

3836
def _is_recursionerror(e):
@@ -68,7 +66,6 @@ def write(self, s):
6866
def getvalue(self):
6967
return self.builder.build()
7068

71-
7269
else:
7370
USING_STRINGBUILDER = False
7471
from io import BytesIO as StringIO
@@ -143,7 +140,6 @@ def _unpack_from(f, b, o=0):
143140
"""Explicit type cast for legacy struct.unpack_from"""
144141
return struct.unpack_from(f, bytes(b), o)
145142

146-
147143
else:
148144
_unpack_from = struct.unpack_from
149145

@@ -322,7 +318,7 @@ def __init__(
322318
self._buf_checkpoint = 0
323319

324320
if not max_buffer_size:
325-
max_buffer_size = 2 ** 31 - 1
321+
max_buffer_size = 2**31 - 1
326322
if max_str_len == -1:
327323
max_str_len = max_buffer_size
328324
if max_bin_len == -1:
@@ -427,6 +423,8 @@ def _reserve(self, n, raise_outofdata=True):
427423

428424
# Read from file
429425
remain_bytes = -remain_bytes
426+
if remain_bytes + len(self._buffer) > self._max_buffer_size:
427+
raise BufferFull
430428
while remain_bytes > 0:
431429
to_read_bytes = max(self._read_size, remain_bytes)
432430
read_data = self.file_like.read(to_read_bytes)
@@ -804,20 +802,20 @@ def _pack(
804802
raise OverflowError("Integer value out of range")
805803
if check(obj, (bytes, bytearray)):
806804
n = len(obj)
807-
if n >= 2 ** 32:
805+
if n >= 2**32:
808806
raise ValueError("%s is too large" % type(obj).__name__)
809807
self._pack_bin_header(n)
810808
return self._buffer.write(obj)
811809
if check(obj, unicode):
812810
obj = obj.encode("utf-8", self._unicode_errors)
813811
n = len(obj)
814-
if n >= 2 ** 32:
812+
if n >= 2**32:
815813
raise ValueError("String is too large")
816814
self._pack_raw_header(n)
817815
return self._buffer.write(obj)
818816
if check(obj, memoryview):
819817
n = len(obj) * obj.itemsize
820-
if n >= 2 ** 32:
818+
if n >= 2**32:
821819
raise ValueError("Memoryview is too large")
822820
self._pack_bin_header(n)
823821
return self._buffer.write(obj)
@@ -899,7 +897,7 @@ def pack_map_pairs(self, pairs):
899897
return ret
900898

901899
def pack_array_header(self, n):
902-
if n >= 2 ** 32:
900+
if n >= 2**32:
903901
raise ValueError
904902
self._pack_array_header(n)
905903
if self._autoreset:
@@ -908,7 +906,7 @@ def pack_array_header(self, n):
908906
return ret
909907

910908
def pack_map_header(self, n):
911-
if n >= 2 ** 32:
909+
if n >= 2**32:
912910
raise ValueError
913911
self._pack_map_header(n)
914912
if self._autoreset:

src/pip/_vendor/vendor.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ CacheControl==0.12.11 # Make sure to update the license in pyproject.toml for t
22
colorama==0.4.5
33
distlib==0.3.5
44
distro==1.7.0
5-
msgpack==1.0.3
5+
msgpack==1.0.4
66
packaging==21.3
77
pep517==0.12.0
88
platformdirs==2.5.2

0 commit comments

Comments
 (0)