Skip to content

Commit 80e9e56

Browse files
committed
Prepare v1.2.2 release
1 parent 3efeead commit 80e9e56

21 files changed

Lines changed: 196 additions & 68 deletions

.github/workflows/docs.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
14+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
1515

1616
- name: Setup Python
17-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
17+
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
1818
with:
1919
python-version: '3.x'
2020
cache: "pip"

.github/workflows/lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-slim
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
14+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
1515

1616
- name: ruff check
1717
run: |

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ jobs:
2626

2727
steps:
2828
- name: Checkout
29-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
29+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
3030

3131
- name: Set up Python
32-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
32+
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
3333
with:
3434
python-version: ${{ matrix.py }}
3535
allow-prereleases: true

.github/workflows/test_debug.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ jobs:
1111
PYTHON_VERSION: 3.14.6
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
14+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
1515

16-
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
16+
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
1717
with:
1818
path: /opt/python-debug
1919
key: python-debug-${{ runner.os }}-${{ env.PYTHON_VERSION }}

.github/workflows/wheel.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ jobs:
2626
name: Build wheels on ${{ matrix.os }}${{ matrix.name_suffix || '' }}
2727

2828
steps:
29-
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
30-
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
29+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
30+
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
3131
with:
3232
python-version: "3.x"
3333
cache: "pip"
@@ -39,12 +39,12 @@ jobs:
3939
4040
- name: Set up QEMU for emulation
4141
if: matrix.cibw_archs == 'riscv64'
42-
uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0
42+
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
4343
with:
4444
platforms: ${{ matrix.cibw_archs }}
4545

4646
- name: Build
47-
uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0
47+
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
4848
env:
4949
CIBW_TEST_REQUIRES: "pytest"
5050
CIBW_TEST_COMMAND: "pytest {package}/test"
@@ -99,6 +99,6 @@ jobs:
9999
path: dist
100100
merge-multiple: true
101101

102-
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
102+
- uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
103103
#with:
104104
# To test: repository-url: https://test.pypi.org/legacy/

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ Release Date: TBD
55
- Fix the `read_size` documentation. #700
66
- Fix silent truncation when unpacking an out-of-range timestamp with `timestamp=3`. #701
77
- Prevent reentrant calls to `Unpacker.feed()` while unpacking. #704
8+
- Improve error handling and reporting in unpacking functions. #707
9+
- Fix `Timestamp.from_datetime()` precision for far-future datetimes. #710
10+
- Fix typos in the documentation. #712
11+
- Validate the nanoseconds range when unpacking timestamps in the C extension. #716
12+
- Fix a use-after-free in the `unpackb()` `ExtraData` path for non-contiguous input. #722
13+
- Prevent a buffer overflow when converting `Packer`'s `buf_size`. #726
14+
- Translate `RecursionError` to `StackError` in the fallback `Unpacker.skip()`. #727
15+
- Raise `OverflowError` when `use_single_float=True` cannot represent a value. #728
816

917

1018
# 1.2.1

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@
269269
# The format is a list of tuples containing the path and title.
270270
# epub_pre_files = []
271271

272-
# HTML files shat should be inserted after the pages created by sphinx.
272+
# HTML files that should be inserted after the pages created by sphinx.
273273
# The format is a list of tuples containing the path and title.
274274
# epub_post_files = []
275275

msgpack/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from .ext import ExtType, Timestamp
66

77
version = (1, 2, 2)
8-
__version__ = "1.2.2rc1"
8+
__version__ = "1.2.2"
99

1010

1111
if os.environ.get("MSGPACK_PUREPYTHON"):

msgpack/_packer.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ cdef extern from "pack.h":
2727
int msgpack_pack_false(msgpack_packer* pk) except -1
2828
int msgpack_pack_long_long(msgpack_packer* pk, long long d) except -1
2929
int msgpack_pack_unsigned_long_long(msgpack_packer* pk, unsigned long long d) except -1
30-
int msgpack_pack_float(msgpack_packer* pk, float d) except -1
30+
int msgpack_pack_float(msgpack_packer* pk, double d) except -1
3131
int msgpack_pack_double(msgpack_packer* pk, double d) except -1
3232
int msgpack_pack_array(msgpack_packer* pk, size_t l) except -1
3333
int msgpack_pack_map(msgpack_packer* pk, size_t l) except -1
@@ -110,7 +110,7 @@ cdef class Packer:
110110
cdef bint autoreset
111111
cdef bint datetime
112112

113-
def __cinit__(self, buf_size=256*1024, **_kwargs):
113+
def __cinit__(self, size_t buf_size=256*1024, **_kwargs):
114114
self.pk.buf = <char*> PyMem_Malloc(buf_size)
115115
if self.pk.buf == NULL:
116116
raise MemoryError("Unable to allocate internal buffer.")
@@ -179,7 +179,7 @@ cdef class Packer:
179179
raise OverflowError("Integer value out of range")
180180
elif PyFloat_CheckExact(o) if strict else PyFloat_Check(o):
181181
if self.use_float:
182-
msgpack_pack_float(&self.pk, <float>o)
182+
msgpack_pack_float(&self.pk, <double>o)
183183
else:
184184
msgpack_pack_double(&self.pk, <double>o)
185185
elif PyBytesLike_CheckExact(o) if strict else PyBytesLike_Check(o):

msgpack/_unpacker.pyx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ cdef extern from "unpack.h":
4646
Py_ssize_t count
4747

4848
ctypedef int (*execute_fn)(unpack_context* ctx, const char* data,
49-
Py_ssize_t len, Py_ssize_t* off) except? -1
49+
Py_ssize_t len, Py_ssize_t* off) except -1
5050
execute_fn unpack_construct
5151
execute_fn unpack_skip
5252
execute_fn read_array_header
@@ -190,24 +190,23 @@ def unpackb(object packed, *, object object_hook=None, object list_hook=None,
190190
use_list, raw, timestamp, strict_map_key, cerr,
191191
max_str_len, max_bin_len, max_array_len, max_map_len, max_ext_len)
192192
ret = unpack_construct(&ctx, buf, buf_len, &off)
193+
if ret == 1:
194+
obj = unpack_data(&ctx)
195+
if off < buf_len:
196+
# buf may point into a temporary contiguous copy owned by view,
197+
# so the extra data must be copied out before releasing view.
198+
raise ExtraData(obj, PyBytes_FromStringAndSize(buf+off, buf_len-off))
199+
return obj
193200
finally:
194201
PyBuffer_Release(&view);
195202

196-
if ret == 1:
197-
obj = unpack_data(&ctx)
198-
if off < buf_len:
199-
raise ExtraData(obj, PyBytes_FromStringAndSize(buf+off, buf_len-off))
200-
return obj
201-
202203
unpack_clear(&ctx)
203204
if ret == 0:
204205
raise ValueError("Unpack failed: incomplete input")
205206
elif ret == -2:
206207
raise FormatError
207208
elif ret == -3:
208209
raise StackError
209-
elif PyErr_Occurred():
210-
raise
211210
else:
212211
raise ValueError("Unpack failed: error = %d" % (ret,))
213212

@@ -502,8 +501,6 @@ cdef class Unpacker:
502501
raise FormatError
503502
elif ret == -3:
504503
raise StackError
505-
elif PyErr_Occurred():
506-
raise
507504
else:
508505
raise ValueError("Unpack failed: error = %d" % (ret,))
509506
finally:

0 commit comments

Comments
 (0)