diff options
author | Tom Tromey <tromey@adacore.com> | 2023-06-02 09:43:01 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2023-06-12 12:24:07 -0600 |
commit | a1ef65231b379e5b01fc2079d3fdc185c90d704c (patch) | |
tree | f7daa6ce610ff225c19b7da728bea126f2037efd | |
parent | d294a0fc26891eaa8826d19f61db9ce7f7399c03 (diff) | |
download | gdb-a1ef65231b379e5b01fc2079d3fdc185c90d704c.zip gdb-a1ef65231b379e5b01fc2079d3fdc185c90d704c.tar.gz gdb-a1ef65231b379e5b01fc2079d3fdc185c90d704c.tar.bz2 |
Remove f-strings from DAP
Kévin pointed out that gdb claims a minimum Python version of 3.2, but
the DAP code uses f-strings, which were added in 3.6.
This patch removes the uses of f-strings from the DAP code. I can't
test an older version of Python, but I did confirm that this still
works with the version I have.
-rw-r--r-- | gdb/python/lib/gdb/dap/evaluate.py | 2 | ||||
-rw-r--r-- | gdb/python/lib/gdb/dap/io.py | 2 | ||||
-rw-r--r-- | gdb/python/lib/gdb/dap/launch.py | 2 | ||||
-rw-r--r-- | gdb/python/lib/gdb/dap/state.py | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/gdb/python/lib/gdb/dap/evaluate.py b/gdb/python/lib/gdb/dap/evaluate.py index 2b40065..af7bf43 100644 --- a/gdb/python/lib/gdb/dap/evaluate.py +++ b/gdb/python/lib/gdb/dap/evaluate.py @@ -84,7 +84,7 @@ def eval_request( elif context == "repl": return send_gdb_with_response(lambda: _repl(expression, frameId)) else: - raise Exception(f'unknown evaluate context "{context}"') + raise Exception('unknown evaluate context "' + context + '"') @in_gdb_thread diff --git a/gdb/python/lib/gdb/dap/io.py b/gdb/python/lib/gdb/dap/io.py index 7cec7b0..2f3a235 100644 --- a/gdb/python/lib/gdb/dap/io.py +++ b/gdb/python/lib/gdb/dap/io.py @@ -60,7 +60,7 @@ def start_json_writer(stream, queue): seq = seq + 1 encoded = json.dumps(obj) body_bytes = encoded.encode("utf-8") - header = f"Content-Length: {len(body_bytes)}\r\n\r\n" + header = "Content-Length: " + str(len(body_bytes)) + "\r\n\r\n" header_bytes = header.encode("ASCII") stream.write(header_bytes) stream.write(body_bytes) diff --git a/gdb/python/lib/gdb/dap/launch.py b/gdb/python/lib/gdb/dap/launch.py index aee8c2f..c3c09bc 100644 --- a/gdb/python/lib/gdb/dap/launch.py +++ b/gdb/python/lib/gdb/dap/launch.py @@ -59,7 +59,7 @@ def launch( if program is not None: global _program _program = program - send_gdb(f"file {_program}") + send_gdb("file " + _program) if stopAtBeginningOfMainSubprogram: send_gdb(_break_at_main) if len(args) > 0 or env is not None: diff --git a/gdb/python/lib/gdb/dap/state.py b/gdb/python/lib/gdb/dap/state.py index caf654a..f4f81d2 100644 --- a/gdb/python/lib/gdb/dap/state.py +++ b/gdb/python/lib/gdb/dap/state.py @@ -22,4 +22,4 @@ def set_thread(thread_id): if thread_id == 0: log("+++ Thread == 0 +++") else: - exec_and_log(f"thread {thread_id}") + exec_and_log("thread " + str(thread_id)) |