)]}'
{
  "commit": "dff7f6c72d05d8a378dc346e6900ba7c4eba759f",
  "tree": "0a5f7ae2e90402f36fcc8fa77cdaff696275cdba",
  "parents": [
    "65ab41b7d5c612b6000b28f4c50bb256b2a9e22b"
  ],
  "author": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Tue Apr 22 21:31:02 2025 +0100"
  },
  "committer": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Wed Apr 23 15:41:35 2025 +0100"
  },
  "message": "gdb/python: stop using PyObject_IsInstance in py-disasm.c\n\nThe PyObject_IsInstance function can return -1 for errors, 0 to\nindicate false, and 1 to indicate true.\n\nI noticed in python/py-disasm.c that we treat the result of\nPyObject_IsInstance as a bool.  This means that if PyObject_IsInstance\nreturns -1, then this will be treated as true.  The consequence of\nthis is that we will invoke undefined behaviour by treating the result\nfrom the _print_insn call as if it was a DisassemblerResult object,\neven though PyObject_IsInstance raised an error, and the result might\nnot be of the required type.\n\nI could fix this by taking the -1 result into account, however,\ngdb.DisassemblerResult cannot be sub-classed, the type doesn\u0027t have\nthe Py_TPFLAGS_BASETYPE flag.  As such, we can switch to using\nPyObject_TypeCheck instead, which only return 0 or 1, with no error\ncase.\n\nI have also taken the opportunity to improve the error message emitted\nif the result has the wrong type.  Better error message make debugging\nissues easier.\n\nI\u0027ve added a test which exposes the problem when using\nPyObject_IsInstance, and I\u0027ve updated the existing test for the\nimproved error message.\n\nApproved-By: Tom Tromey \u003ctom@tromey.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "9ca8d225e7e76558a665161e565b95f1eef37590",
      "old_mode": 33188,
      "old_path": "gdb/python/py-disasm.c",
      "new_id": "17064dc0c300ec15849e919f050cdffb11ed8df8",
      "new_mode": 33188,
      "new_path": "gdb/python/py-disasm.c"
    },
    {
      "type": "modify",
      "old_id": "938326dd9cfce24038ef97415fe57f5d4053357e",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.python/py-disasm.exp.tcl",
      "new_id": "c5099bac22cfdad8466b71aae6ba17fa956156e4",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.python/py-disasm.exp.tcl"
    },
    {
      "type": "modify",
      "old_id": "32d6aa7dc8260c329b7dfabcae3fd909887dd68d",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.python/py-disasm.py",
      "new_id": "9761337550a345bd0b2e1144adc1cbed13d1202e",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.python/py-disasm.py"
    }
  ]
}
