tomerfiliba/rpyc — Issue #66: Error in brine.py with TAG_EMPTY_STR
Author: pyscripter
Created: 2012-02-28 18:56:20+00:00
State: open

The following function will produce an error in python 3k.

@register(_load_registry, TAG_EMPTY_STR)
def _load_empty_str(stream):
return ""

The reason is that it will return a unicode string and later _load_unicode will complain that an str object has no method "decode".

Solution:

if is_py3k:
@register(_load_registry, TAG_EMPTY_STR)
def _load_empty_str(stream):
return b""
else:
@register(_load_registry, TAG_EMPTY_STR)
def _load_empty_str(stream):
return ""