mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-10-20 04:13:16 +00:00
Fix build and tests.
This commit is contained in:
parent
5cfa49bb2c
commit
d6c773dc4d
2 changed files with 3 additions and 11 deletions
|
@ -55,15 +55,7 @@ static inline int unpack_callback_uint8(unpack_user* u, uint8_t d, msgpack_unpac
|
||||||
|
|
||||||
static inline int unpack_callback_uint32(unpack_user* u, uint32_t d, msgpack_unpack_object* o)
|
static inline int unpack_callback_uint32(unpack_user* u, uint32_t d, msgpack_unpack_object* o)
|
||||||
{
|
{
|
||||||
PyObject *p;
|
PyObject *p = PyInt_FromSize_t((size_t)d);
|
||||||
#if UINT32_MAX > LONG_MAX
|
|
||||||
if (d > LONG_MAX) {
|
|
||||||
p = PyLong_FromUnsignedLong((unsigned long)d);
|
|
||||||
} else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
p = PyInt_FromUnsignedLong((long)d);
|
|
||||||
}
|
|
||||||
if (!p)
|
if (!p)
|
||||||
return -1;
|
return -1;
|
||||||
*o = p;
|
*o = p;
|
||||||
|
|
|
@ -21,14 +21,14 @@ def test_integer():
|
||||||
def test_array_header():
|
def test_array_header():
|
||||||
packer = Packer()
|
packer = Packer()
|
||||||
packer.pack_array_header(2**32-1)
|
packer.pack_array_header(2**32-1)
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises((OverflowError, ValueError)):
|
||||||
packer.pack_array_header(2**32)
|
packer.pack_array_header(2**32)
|
||||||
|
|
||||||
|
|
||||||
def test_map_header():
|
def test_map_header():
|
||||||
packer = Packer()
|
packer = Packer()
|
||||||
packer.pack_map_header(2**32-1)
|
packer.pack_map_header(2**32-1)
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises((OverflowError, ValueError)):
|
||||||
packer.pack_array_header(2**32)
|
packer.pack_array_header(2**32)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue