[Lldb-commits] [lldb] 4a3a821 - [lldb] Make socket_packet_pump.py work in Python3

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 23 09:37:08 PDT 2020


Author: Raphael Isemann
Date: 2020-07-23T18:36:50+02:00
New Revision: 4a3a821c68a1ca4a44de86c5fe88b026134b39c9

URL: https://github.com/llvm/llvm-project/commit/4a3a821c68a1ca4a44de86c5fe88b026134b39c9
DIFF: https://github.com/llvm/llvm-project/commit/4a3a821c68a1ca4a44de86c5fe88b026134b39c9.diff

LOG: [lldb] Make socket_packet_pump.py work in Python3

Summary:

The `string_escape` encoding used here was removed in Python 3 which makes the
test crash during tearDown:

```
  File "lldb/third_party/Python/module/unittest2/unittest2/case.py", line 386, in run
    self.tearDown()
  File "lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py", line 124, in tearDown
    self._pump_queues.verify_queues_empty()
  File "lldb/packages/Python/lldbsuite/test/tools/lldb-server/socket_packet_pump.py", line 55, in verify_queues_empty
    _dump_queue(self.packet_queue())
  File "lldb/packages/Python/lldbsuite/test/tools/lldb-server/socket_packet_pump.py", line 28, in _dump_queue
    print(codecs.encode(the_queue.get(True), "string_escape"))
LookupError: unknown encoding: string_escape
```

Just replace it with `repr` which should work in both Python versions.

Reviewers: labath, JDevlieghere

Reviewed By: labath, JDevlieghere

Subscribers: JDevlieghere

Differential Revision: https://reviews.llvm.org/D84017

Added: 
    

Modified: 
    lldb/packages/Python/lldbsuite/test/tools/lldb-server/socket_packet_pump.py

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/socket_packet_pump.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/socket_packet_pump.py
index 958d6449b516..3de76345896d 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/socket_packet_pump.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/socket_packet_pump.py
@@ -6,7 +6,6 @@
 import select
 import threading
 import traceback
-import codecs
 
 from six.moves import queue
 from lldbsuite.support import seven
@@ -25,7 +24,7 @@ def _handle_output_packet_string(packet_contents):
 
 def _dump_queue(the_queue):
     while not the_queue.empty():
-        print(codecs.encode(the_queue.get(True), "string_escape"))
+        print(repr(the_queue.get(True)))
         print("\n")
 
 


        


More information about the lldb-commits mailing list