)]}'
{
  "commit": "c07ec31edf5c032da8d22155ac98edbecba51aa7",
  "tree": "b4cd0f0f130d485c104b25e5709b3add4f6ba169",
  "parents": [
    "e916d846bf90c0405fb57a70ad9b0b4cb9cacc1e"
  ],
  "author": {
    "name": "Jason Rhinelander",
    "email": "jason@imaginary.ca",
    "time": "Sun Nov 06 13:12:48 2016 -0500"
  },
  "committer": {
    "name": "Wenzel Jakob",
    "email": "wenzel.jakob@epfl.ch",
    "time": "Sun Nov 06 19:12:48 2016 +0100"
  },
  "message": "Don\u0027t construct unique_ptr around unowned pointers (#478)\n\nIf we need to initialize a holder around an unowned instance, and the\r\nholder type is non-copyable (i.e. a unique_ptr), we currently construct\r\nthe holder type around the value pointer, but then never actually\r\ndestruct the holder: the holder destructor is called only for the\r\ninstance that actually has `inst-\u003eowned \u003d true` set.\r\n\r\nThis seems no pointer, however, in creating such a holder around an\r\nunowned instance: we never actually intend to use anything that the\r\nunique_ptr gives us: and, in fact, do not want the unique_ptr (because\r\nif it ever actually got destroyed, it would cause destruction of the\r\nwrapped pointer, despite the fact that that wrapped pointer isn\u0027t\r\nowned).\r\n\r\nThis commit changes the logic to only create a unique_ptr holder if we\r\nactually own the instance, and to destruct via the constructed holder\r\nwhenever we have a constructed holder--which will now only be the case\r\nfor owned-unique-holder or shared-holder types.\r\n\r\nOther changes include:\r\n\r\n* Added test for non-movable holder constructor/destructor counts\r\n\r\nThe three alive assertions now pass, before #478 they fail with counts\r\nof 2/2/1 respectively, because of the unique_ptr that we don\u0027t want and\r\ndon\u0027t destroy (because we don\u0027t *want* its destructor to run).\r\n\r\n* Return cstats reference; fix ConstructStats doc\r\n\r\nSmall cleanup to the #478 test code, and fix to the ConstructStats\r\ndocumentation (the static method definition should use `reference` not\r\n`reference_internal`).\r\n\r\n* Rename inst-\u003econstructed to inst-\u003eholder_constructed\r\n\r\nThis makes it clearer exactly what it\u0027s referring to.\r\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "e684b187edf6c084f6e1cf5347eda2c89d65ed0f",
      "old_mode": 33188,
      "old_path": "include/pybind11/common.h",
      "new_id": "c422081e15d75cc7daea8801f8d26f54f8a30f53",
      "new_mode": 33188,
      "new_path": "include/pybind11/common.h"
    },
    {
      "type": "modify",
      "old_id": "d845d18a7be387f2a3f36fff176a2d427cb9371a",
      "old_mode": 33188,
      "old_path": "include/pybind11/pybind11.h",
      "new_id": "93f55ef967e146bc931043f783021b77d8498fdf",
      "new_mode": 33188,
      "new_path": "include/pybind11/pybind11.h"
    },
    {
      "type": "modify",
      "old_id": "5dd215f1904651b3ba68bf69f6bb328946fa82b3",
      "old_mode": 33188,
      "old_path": "tests/constructor_stats.h",
      "new_id": "eb3e49cabf715b0ca7d6d96950010e005c7d7e10",
      "new_mode": 33188,
      "new_path": "tests/constructor_stats.h"
    },
    {
      "type": "modify",
      "old_id": "362ad448b5a19044bbb831b9d851ac501a67ae4e",
      "old_mode": 33188,
      "old_path": "tests/test_issues.cpp",
      "new_id": "1374afeb7f3d4debede9a260d66fb82db950ca7b",
      "new_mode": 33188,
      "new_path": "tests/test_issues.cpp"
    },
    {
      "type": "modify",
      "old_id": "208cf3b41a381c0d098f2af445470d6c4d1c9cb4",
      "old_mode": 33188,
      "old_path": "tests/test_issues.py",
      "new_id": "6f84f777b483eab968652ea090708a3ac9eb7bf8",
      "new_mode": 33188,
      "new_path": "tests/test_issues.py"
    }
  ]
}
