Re: [PATCH] rpc: fix str to bytes conversion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Applied.--b.

On Wed, Mar 18, 2020 at 11:40:31AM +0100, Tigran Mkrtchyan wrote:
> fix back channel ping from server
> ---
>  rpc/rpc.py | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/rpc/rpc.py b/rpc/rpc.py
> index c536384..d15cf06 100644
> --- a/rpc/rpc.py
> +++ b/rpc/rpc.py
> @@ -693,8 +693,11 @@ class ConnectionHandler(object):
>                  status, result, notify = tuple
>              if result is None:
>                  result = b''
> +            if isinstance(result, str):
> +                result = bytes(result, encoding='UTF-8')
> +
>              if not isinstance(result, bytes):
> -                raise TypeError("Expected string")
> +                raise TypeError("Expected bytes, got %s" % type(result))
>              # status, result = method(msg_data, call_info)
>              log_t.debug("Called method, got %r, %r" % (status, result))
>          except rpclib.RPCDrop:
> -- 
> 2.25.1



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux