[Lldb-commits] [lldb] r254550 - Candidate fixes for python2/3 compatible string handling in pickling support.

Todd Fiala via lldb-commits lldb-commits at lists.llvm.org
Wed Dec 2 13:45:16 PST 2015


Author: tfiala
Date: Wed Dec  2 15:45:15 2015
New Revision: 254550

URL: http://llvm.org/viewvc/llvm-project?rev=254550&view=rev
Log:
Candidate fixes for python2/3 compatible string handling in pickling support.

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/dotest_channels.py
    lldb/trunk/packages/Python/lldbsuite/test/test_results.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest_channels.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest_channels.py?rev=254550&r1=254549&r2=254550&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/dotest_channels.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest_channels.py Wed Dec  2 15:45:15 2015
@@ -47,7 +47,7 @@ class UnpicklingForwardingReaderChannel(
         self.header_contents = ''
         self.packet_bytes_remaining = 0
         self.reading_header = True
-        self.ibuffer = ''
+        self.ibuffer = b''
         self.forwarding_func = forwarding_func
         if forwarding_func is None:
             # This whole class is useless if we do nothing with the
@@ -58,7 +58,7 @@ class UnpicklingForwardingReaderChannel(
         """Unpickles the collected input buffer bytes and forwards."""
         if len(self.ibuffer) > 0:
             self.forwarding_func(cPickle.loads(self.ibuffer))
-            self.ibuffer = ''
+            self.ibuffer = b''
 
     def consume_header_bytes(self, data):
         """Consumes header bytes from the front of data.

Modified: lldb/trunk/packages/Python/lldbsuite/test/test_results.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/test_results.py?rev=254550&r1=254549&r2=254550&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/test_results.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/test_results.py Wed Dec  2 15:45:15 2015
@@ -1029,8 +1029,8 @@ class RawPickledFormatter(ResultsFormatt
 
         # Send it as {serialized_length_of_serialized_bytes}#{serialized_bytes}
         pickled_message = cPickle.dumps(test_event)
-        self.out_file.send(
-            "{}#{}".format(len(pickled_message), pickled_message))
+        self.out_file.send("{}#".format(len(pickled_message)))
+        self.out_file.send(pickled_message)
 
 
 class DumpFormatter(ResultsFormatter):




More information about the lldb-commits mailing list