Python debugger backend: modified code to convert bytes and bytearray objects to their representation before sending them via JSON.

Tue, 06 Oct 2020 17:55:10 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 06 Oct 2020 17:55:10 +0200
changeset 7760
fcd3322bf6ed
parent 7759
51aa6c6b66f7
child 7761
ed2c67d20328

Python debugger backend: modified code to convert bytes and bytearray objects to their representation before sending them via JSON.

eric6/DebugClients/Python/AsyncFile.py file | annotate | diff | comparison | revisions
--- a/eric6/DebugClients/Python/AsyncFile.py	Tue Oct 06 17:52:44 2020 +0200
+++ b/eric6/DebugClients/Python/AsyncFile.py	Tue Oct 06 17:55:10 2020 +0200
@@ -333,10 +333,14 @@
         Public method to write a string to the file.
         
         @param s text to be written
-        @type str
+        @type str, bytes or bytearray
         """
         self.__checkMode('w')
         
+        if isinstance(s, (bytes, bytearray)):
+            # convert to string to send it
+            s = repr(s)
+        
         cmd = prepareJsonCommand("ClientOutput", {
             "text": s,
         })

eric ide

mercurial