MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / internal_change_variable

Function internal_change_variable

_pydevd_bundle/pydevd_comm.py:886–903  ·  view source on GitHub ↗

Changes the value of a variable

(dbg, seq, thread_id, frame_id, scope, attr, value)

Source from the content-addressed store, hash-verified

884
885
886def internal_change_variable(dbg, seq, thread_id, frame_id, scope, attr, value):
887 """Changes the value of a variable"""
888 try:
889 frame = dbg.find_frame(thread_id, frame_id)
890 if frame is not None:
891 result = pydevd_vars.change_attr_expression(frame, attr, value, dbg)
892 else:
893 result = None
894 xml = "<xml>"
895 xml += pydevd_xml.var_to_xml(result, "")
896 xml += "</xml>"
897 cmd = dbg.cmd_factory.make_variable_changed_message(seq, xml)
898 dbg.writer.add_command(cmd)
899 except Exception:
900 cmd = dbg.cmd_factory.make_error_message(
901 seq, "Error changing variable attr:%s expression:%s traceback:%s" % (attr, value, get_exception_traceback_str())
902 )
903 dbg.writer.add_command(cmd)
904
905
906def internal_change_variable_json(py_db, request):

Callers

nothing calls this directly

Calls 5

make_error_messageMethod · 0.80
find_frameMethod · 0.45
add_commandMethod · 0.45

Tested by

no test coverage detected