irmen / Pyro5

Pyro 5 - Python remote objects
https://pyro5.readthedocs.io
MIT License
305 stars 36 forks source link

msgpack serializes tuples into lists #37

Closed eudoxos closed 3 years ago

eudoxos commented 3 years ago

Tuple sent over the wire will be deserialized as list; this is a "feature" of msgpack. Other projects were facing this as well, e.g. https://github.com/dask/distributed/issues/3716#issuecomment-632913789 . Their idea is to add a special tag to tuples so that they can be reconstructed properly. Could something like this be done in Pyro as well?

irmen commented 3 years ago

Pyro supports this by creating custom (de)serializers for classes. The problem I here is that you want this for tuples which are a primitive type. Also msgpack can't serialize custom classes. So no, you cannot do this with Pyro itself.

However, consider one of the following?

eudoxos commented 3 years ago

Hi, unfortunately the client code does make a distinction of lists and tuples.

I switched to serpent (hwere I have the issue with bytes being returned as a dict on the remote end, so needs some special-casing), but as far as I was concerned, msgpack was faster. Just did not work with the tuples, right.