8000 Fix build and tests. · didlie/msgpack-python@d6c773d · GitHub
[go: up one dir, main page]

Skip to content

Commit d6c773d

Browse files
committed
Fix build and tests.
1 parent 5cfa49b commit d6c773d

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

msgpack/unpack.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,7 @@ static inline int unpack_callback_uint8(unpack_user* u, uint8_t d, msgpack_unpac
5555

5656
static inline int unpack_callback_uint32(unpack_user* u, uint32_t d, msgpack_unpack_object* o)
5757
{
58-
PyObject *p;
59-
#if UINT32_MAX > LONG_MAX
60-
if (d > LONG_MAX) {
61-
p = PyLong_FromUnsignedLong((unsigned long)d);
62-
} else
63-
#endif
64-
{
65-
p = PyInt_FromUnsignedLong((long)d);
66-
}
58+
PyObject *p = PyInt_FromSize_t((size_t)d);
6759
if (!p)
6860
return -1;
6961
*o = p;

test/test_limits.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ def test_integer():
2121
def test_array_header():
2222
packer = Packer()
2323
packer.pack_array_header(2**32-1)
24-
with pytest.raises(ValueError):
24+
with pytest.raises((OverflowError, ValueError)):
2525
packer.pack_array_header(2**32)
2626

2727

2828
def test_map_header():
2929
packer = Packer()
3030
packer.pack_map_header(2**32-1)
31-
with pytest.raises(ValueError):
31+
with pytest.raises((OverflowError, ValueError)):
3232
packer.pack_array_header(2**32)
3333

3434

0 commit comments

Comments
 (0)
0