Index: lldb/packages/Python/lldbsuite/test/tools/lldb-server/socket_packet_pump.py =================================================================== --- lldb/packages/Python/lldbsuite/test/tools/lldb-server/socket_packet_pump.py +++ lldb/packages/Python/lldbsuite/test/tools/lldb-server/socket_packet_pump.py @@ -7,6 +7,7 @@ import threading import traceback import codecs +import sys from six.moves import queue from lldbsuite.support import seven @@ -25,7 +26,11 @@ def _dump_queue(the_queue): while not the_queue.empty(): - print(codecs.encode(the_queue.get(True), "string_escape")) + # 'string_escape' is only avilable in Python 2. + if sys.version_info.major == 2: + print(codecs.encode(the_queue.get(True), "string_escape")) + else: + print(codecs.encode(the_queue.get(True), "unicode_escape")) print("\n")