linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rpc: fix str to bytes conversion
@ 2020-03-18 10:40 Tigran Mkrtchyan
  2020-03-24 21:18 ` J. Bruce Fields
  0 siblings, 1 reply; 2+ messages in thread
From: Tigran Mkrtchyan @ 2020-03-18 10:40 UTC (permalink / raw)
  To: bfields; +Cc: linux-nfs, Tigran Mkrtchyan

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-24 21:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-18 10:40 [PATCH] rpc: fix str to bytes conversion Tigran Mkrtchyan
2020-03-24 21:18 ` J. Bruce Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).