Skip to content

Commit 833b85f

Browse files
committed
Merge branch '0.2-maint' (fix #39)
2 parents 647af23 + 451631a commit 833b85f

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

msgpack/unpack_template.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ msgpack_unpack_func(int, _execute)(msgpack_unpack_struct(_context)* ctx, const c
146146
if(top >= MSGPACK_EMBED_STACK_SIZE) { goto _failed; } /* FIXME */ \
147147
if(construct_cb(func)(user, count_, &stack[top].obj) < 0) { goto _failed; } \
148148
if((count_) == 0) { obj = stack[top].obj; \
149-
construct_cb(func##_end)(user, &obj); \
149+
if (construct_cb(func##_end)(user, &obj) < 0) { goto _failed; } \
150150
goto _push; } \
151151
stack[top].ct = ct_; \
152152
stack[top].size = count_; \

test/test_except.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,28 @@
66

77
import datetime
88

9+
class DummyException(Exception):
10+
pass
11+
12+
913
def test_raise_on_find_unsupported_value():
1014
assert_raises(TypeError, packb, datetime.datetime.now())
1115

16+
17+
def test_raise_from_object_hook():
18+
def hook(obj):
19+
raise DummyException
20+
assert_raises(DummyException, unpackb, packb({}), object_hook=hook)
21+
assert_raises(DummyException, unpackb, packb({'fizz': 'buzz'}),
22+
object_hook=hook)
23+
assert_raises(DummyException, unpackb, packb({'fizz': 'buzz'}),
24+
object_pairs_hook=hook)
25+
assert_raises(DummyException, unpackb, packb({'fizz': {'buzz': 'spam'}}),
26+
object_hook=hook)
27+
assert_raises(DummyException, unpackb, packb({'fizz': {'buzz': 'spam'}}),
28+
object_pairs_hook=hook)
29+
30+
1231
if __name__ == '__main__':
1332
from nose import main
1433
main()

test/test_obj.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_decode_pairs_hook():
3434

3535
@raises(ValueError)
3636
def test_only_one_obj_hook():
37-
unpackb(b'', object_hook=lambda x: x, object_pairs_hook=lambda x: x)
37+
unpackb(b'', object_hook=lambda x: x, object_pairs_hook=lambda x: x, use_list=1)
3838

3939
@raises(ValueError)
4040
def test_bad_hook():

test/test_sequnpack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test_foobar_skip():
4646
assert 1, "ok"
4747

4848
def test_maxbuffersize():
49-
nose.tools.assert_raises(ValueError, Unpacker, read_size=5, max_buffer_size=3)
49+
nose.tools.assert_raises(ValueError, Unpacker, read_size=5, max_buffer_size=3, use_list=1)
5050
unpacker = Unpacker(read_size=3, max_buffer_size=3, use_list=1)
5151
unpacker.feed(b'fo')
5252
nose.tools.assert_raises(BufferFull, unpacker.feed, b'ob')

0 commit comments

Comments
 (0)