msgpack/msgpack-rpc-python — pull request #7 by kazupon (2012-03-30 14:21:04+00:00)
Title: the return value from the server 

When the client have got `None` value from the server, `AssertionError` is raised.

The following is a sample server-side and client-side code that causes this problem.

## server

import msgpackrpc

class Server:
def sum(self, x, y):
return x + y
def something_no_return_func(self):
# somthing do ..
x = 1
# return None

server = msgpackrpc.Server(Server())
server.listen(msgpackrpc.Address("localhost", 18800))
server.start()

## client

import msgpackrpc

client = msgpackrpc.Client(msgpackrpc.Address("localhost", 18800))
result = client.call('sum', 1, 2)
result = client.call('something_no_return_func')

## error

$ python client.py
ERROR:root:Uncaught exception, closing connection.
Traceback (most recent call last):
File "/Users/kazupon/.virtualenvs/kt-msgpack/lib/python2.7/site-packages/tornado/iostream.py", line 304, in wrapper
callback(*args)
File "/Users/kazupon/.virtualenvs/kt-msgpack/lib/python2.7/site-packages/msgpackrpc/transport/tcp.py", line 26, in on_read
self.on_message(message)
File "/Users/kazupon/.virtualenvs/kt-msgpack/lib/python2.7/site-packages/msgpackrpc/transport/tcp.py", line 37, in on_message
self.on_response(message[1], message[2], message[3])
File "/Users/kazupon/.virtualenvs/kt-msgpack/lib/python2.7/site-packages/msgpackrpc/transport/tcp.py", line 73, in on_response
self._transport._session.on_response(msgid, error, result)
File "/Users/kazupon/.virtualenvs/kt-msgpack/lib/python2.7/site-packages/msgpackrpc/session.py", line 99, in on_response
future.set_result(result)
File "/Users/kazupon/.virtualenvs/kt-msgpack/lib/python2.7/site-packages/msgpackrpc/future.py", line 47, in set_result
assert result is not None
AssertionError
ERROR:root:Exception in callback
Traceback (most recent call last):
File "/Users/kazupon/.virtualenvs/kt-msgpack/lib/python2.7/site-packages/tornado/ioloop.py", line 399, in _run_callback
callback()
File "/Users/kazupon/.virtualenvs/kt-msgpack/lib/python2.7/site-packages/tornado/iostream.py", line 304, in wrapper
callback(*args)
File "/Users/kazupon/.virtualenvs/kt-msgpack/lib/python2.7/site-packages/msgpackrpc/transport/tcp.py", line 26, in on_read
self.on_message(message)
File "/Users/kazupon/.virtualenvs/kt-msgpack/lib/python2.7/site-packages/msgpackrpc/transport/tcp.py", line 37, in on_message
self.on_response(message[1], message[2], message[3])
File "/Users/kazupon/.virtualenvs/kt-msgpack/lib/python2.7/site-packages/msgpackrpc/transport/tcp.py", line 73, in on_response
self._transport._session.on_response(msgid, error, result)
File "/Users/kazupon/.virtualenvs/kt-msgpack/lib/python2.7/site-packages/msgpackrpc/session.py", line 99, in on_response
future.set_result(result)
File "/Users/kazupon/.virtualenvs/kt-msgpack/lib/python2.7/site-packages/msgpackrpc/future.py", line 47, in set_result
assert result is not None
AssertionError

I fixed the this problem.
This value may be received from a server that is different from other language implementation.
Please review :-)