From 499611a20ffae5fcec25655e36502d44603d717f Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Tue, 19 Feb 2019 08:25:25 +0000 Subject: Fix vscode tests for python3 encode/decode the data before sending it over the socket. Since (AFAICT) the vscode protocol (unlike the gdb-remote one) is fully textual, using the utf8 codec here is appropriate. llvm-svn: 354308 --- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lldb/packages/Python/lldbsuite/test') diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py index 066158d0877..99986bc96a2 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py @@ -54,7 +54,7 @@ def read_packet(f, verbose=False, trace_file=None): '''Decode a JSON packet that starts with the content length and is followed by the JSON bytes from a file 'f' ''' - line = f.readline() + line = f.readline().decode("utf-8") if len(line) == 0: return None @@ -121,7 +121,7 @@ class DebugCommunication(object): @classmethod def encode_content(cls, s): - return "Content-Length: %u\r\n\r\n%s" % (len(s), s) + return ("Content-Length: %u\r\n\r\n%s" % (len(s), s)).encode("utf-8") @classmethod def validate_response(cls, command, response): -- cgit v1.2.3