Skip to content

Instantly share code, notes, and snippets.

@joonty
Last active July 4, 2020 13:45
Show Gist options
  • Save joonty/3348076 to your computer and use it in GitHub Desktop.
Save joonty/3348076 to your computer and use it in GitHub Desktop.
Patch for client.py, part of the Komodo Python remote debugger. Fixes an exception being raised when "eval" is used, for versions 7.1.0 and 8.5.0.
3249,3250c3249
< _eval_optlist = [['i','transaction_id', int, 1, -1, None],
< ['l','length', int, 1, 0, None]]
---
> _eval_optlist = [['i','transaction_id', int, 1, -1, None]]
3252c3251
< (tid, data_length, data,) = self._getopts(cmdargs, self._eval_optlist, "eval")
---
> (tid, data,) = self._getopts(cmdargs, self._eval_optlist, "eval")
3268,3269c3267,3268
< prop = Property(None, None, value, self._data_encoding,
< self._show_hidden, hiddenContextTypes[context_id])
---
> prop = Property(data, data, value, self._data_encoding,
> self._show_hidden, hiddenContextTypes[0])
3426,3427c3426
< _eval_optlist = [['i','transaction_id', int, 1, -1, None],
< ['l','length', int, 1, 0, None]]
---
> _eval_optlist = [['i','transaction_id', int, 1, -1, None]]
3429c3428
< (tid, data_length, data,) = self._getopts(cmdargs, self._eval_optlist,
"eval")
---
> (tid, data,) = self._getopts(cmdargs, self._eval_optlist, "eval")
3445,3446c3444,3445
< prop = Property(None, None, value, self._data_encoding,
< self._show_hidden, hiddenContextTypes[context_id])
---
> prop = Property(data, data, value, self._data_encoding,
> self._show_hidden, hiddenContextTypes[0])
@bitwombat
Copy link

If you're happy to use Komodo-PythonRemoteDebugging-11.1.0-91033, this might work. Same edits as above, just different line numbers.

--- client.py	2020-06-21 14:32:45.269921276 +1000
+++ client.py.orig	2020-06-21 14:23:37.376844510 +1000
@@ -3433,10 +3433,10 @@
         _template = '<response xmlns="urn:debugger_protocol_v1" command="breakpoint_list" transaction_id="%s">%s</response>'
         self.socket.send_response(_template % (tid, bpinfo))
 
-    _eval_optlist = [['i','transaction_id', int, 1, -1, None]]
-
+    _eval_optlist = [['i','transaction_id', int, 1, -1, None],
+                ['l','length', int, 1, 0, None]]
     def do_eval(self, cmdargs, *args):
-        (tid, data,) = self._getopts(cmdargs, self._eval_optlist, "eval")
+        (tid, data_length, data,) = self._getopts(cmdargs, self._eval_optlist, "eval")
         
         # read data_length from the socket
         if self._data_encoding == 'base64':
@@ -3452,8 +3452,8 @@
             raise CommandError('eval', tid, ERROR_EVAL_FAILED,
                            'eval of expression failed: '+str(e))
 
-        prop = Property(data, data, value, self._data_encoding,
-                            self._show_hidden, hiddenContextTypes[0])
+        prop = Property(None, None, value, self._data_encoding,
+                            self._show_hidden, hiddenContextTypes[context_id])
         
         _template = '<response xmlns="urn:debugger_protocol_v1" command="eval" transaction_id="%s">%s</response>'
 

@gilbh
Copy link

gilbh commented Jul 4, 2020

I verified that client.py was patched (as shown in all above codes) but still I am getting the same error:
required argument [l:length] missing

-- any idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment