)]}'
{
  "commit": "474ef1e8cf58c06d375276ccaab1b1e486fbb190",
  "tree": "a3bd468c06832d04722a77db53f8cea414989c56",
  "parents": [
    "351d6eb6d775e1e9739c52dc8749738cbcf170be"
  ],
  "author": {
    "name": "Stefan Agner",
    "email": "stefan@agner.ch",
    "time": "Wed Jul 17 18:26:56 2024 +0100"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Wed Jul 17 17:26:56 2024 +0000"
  },
  "message": "[Python] Avoid RuntimeException if APIs with future raise an error (#34354)\n\nCurrently, when calling an API which uses a future causes an error\n(e.g. CommissionWithCode with an invalid code), then the API call\nalready returns an error. In this case the call `raise_on_error()` on\nthe returned PyChipError object make sure that an exception is raised.\nHowever, this also causes the `CallbackContext` context manager to\nexit.\n\nAt this point the future is initialized but never completed, which\ntriggers the previously introduced sanity check in `CallbackContext`:\n`RuntimeError(\"CallbackContext future not completed\")`.\n\nRemove the RuntimeError as existing the context manager early without\ncompleting the future is a use case (when the call setting up the\ncallback raises an exception).\n\nInstead, just cancel the future in the context manager if it hasn\u0027t\nbeen complete yet, in case someone has a reference to it and expects\nit to complete.\n\nAlso, since most API calls return PyChipError, this changes\n`CallAsync()` to raise an exception by default instead of returning a\nPyChipError object. If the PyChipError object is required or an API\nreturns something else, the CallAsyncWithResult() method can be used.",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "d9c9196015c96d699604a6325554d4c51758da00",
      "old_mode": 33188,
      "old_path": "src/controller/python/chip/ChipDeviceCtrl.py",
      "new_id": "5023a1946e4b9d5cf2c55cc24dcbc95368ee1378",
      "new_mode": 33188,
      "new_path": "src/controller/python/chip/ChipDeviceCtrl.py"
    },
    {
      "type": "modify",
      "old_id": "dc4efc223f491d8474639ab7b39ac141d09a475a",
      "old_mode": 33188,
      "old_path": "src/controller/python/chip/ChipStack.py",
      "new_id": "b717859c70351d5573d1fde62dabb87a12369552",
      "new_mode": 33188,
      "new_path": "src/controller/python/chip/ChipStack.py"
    },
    {
      "type": "modify",
      "old_id": "ba4c5d4b72dbe6a5597dca1a14eaba9f7ae6ad0e",
      "old_mode": 33188,
      "old_path": "src/controller/python/chip/clusters/Attribute.py",
      "new_id": "ab572cb0984e15cbeb7a1f96987f8b86b7b69b1d",
      "new_mode": 33188,
      "new_path": "src/controller/python/chip/clusters/Attribute.py"
    },
    {
      "type": "modify",
      "old_id": "93951338f988f537dc585b21fae9a2e5b97860f3",
      "old_mode": 33188,
      "old_path": "src/controller/python/chip/clusters/Command.py",
      "new_id": "785bb3d3daf47fc2fc88efc3159c9974fe7243bc",
      "new_mode": 33188,
      "new_path": "src/controller/python/chip/clusters/Command.py"
    }
  ]
}
