)]}'
{
  "commit": "2135495484109f888167287cca249be9d84ed535",
  "tree": "db901801f555dc0124dce751151b7c728518724f",
  "parents": [
    "772f8196d621a8009035ff4cb8aab2d7343269a9"
  ],
  "author": {
    "name": "Tom de Vries",
    "email": "tdevries@suse.de",
    "time": "Mon Jun 27 12:47:26 2022 +0200"
  },
  "committer": {
    "name": "Tom de Vries",
    "email": "tdevries@suse.de",
    "time": "Mon Jun 27 12:47:26 2022 +0200"
  },
  "message": "[gdb/testsuite] Handle older python in gdb.python/py-send-packet.py\n\nWith python 3.4, I run into:\n...\nTraceback (most recent call last):^M\n  File \"\u003cstring\u003e\", line 1, in \u003cmodule\u003e^M\n  File\n  \"outputs/gdb.python/py-send-packet/py-send-packet.py\", line 128, in \\\n    run_set_global_var_test^M\n    res \u003d conn.send_packet(b\"X%x,4:\\x02\\x02\\x02\\x02\" % addr)^M\nTypeError: Could not convert Python object: b\u0027X%x,4:\\x02\\x02\\x02\\x02\u0027.^M\nError while executing Python code.^M\n...\nwhile with python 3.6 this works fine.\n\nThe type of addr is \u003cclass \u0027gdb.Value\u0027\u003e, so the first thing to try is whether\nchanging it into a string works:\n...\n    addr_str \u003d \"%x\" % addr\n    res \u003d conn.send_packet(b\"X%s,4:\\x02\\x02\\x02\\x02\" % addr_str)\n...\nwhich gets us the more detailed:\n...\nTypeError: unsupported operand type(s) for %: \u0027bytes\u0027 and \u0027str\u0027\n...\n\nFix this by avoiding the \u0027%\u0027 operator in the byte literal, and use instead:\n...\ndef xpacket_header (addr):\n    return (\"X%x,4:\" % addr).encode(\u0027ascii\u0027)\n  ...\n    res \u003d conn.send_packet(xpacket_header(addr) + b\"\\x02\\x02\\x02\\x02\")\n...\n\nTested on x86_64-linux, with python 3.4 and 3.6, and a backported version was\ntested on the gdb-12-branch in combination with python 2.7.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "a6adc8279cb4fe51c147d70829d03d72964e1dcb",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.python/py-send-packet.py",
      "new_id": "ae70b852538d20f34faf9c2dfd4337164bd974ad",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.python/py-send-packet.py"
    }
  ]
}
