diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/pybindings.cc | 2 | ||||
-rw-r--r-- | common/pybindings.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/common/pybindings.cc b/common/pybindings.cc index 49acb996..e1a7d313 100644 --- a/common/pybindings.cc +++ b/common/pybindings.cc @@ -145,7 +145,7 @@ PYBIND11_MODULE(MODULE_NAME, m) typedef std::unordered_map<IdString, IdString> IdIdMap; typedef std::unordered_map<IdString, std::unique_ptr<Region>> RegionMap; - py::class_<BaseCtx, std::unique_ptr<BaseCtx, py::nodelete>>(m, "BaseCtx"); + py::class_<BaseCtx>(m, "BaseCtx"); auto loc_cls = py::class_<Loc>(m, "Loc") .def(py::init<int, int, int>()) diff --git a/common/pybindings.h b/common/pybindings.h index 4923c821..e143ddf4 100644 --- a/common/pybindings.h +++ b/common/pybindings.h @@ -45,7 +45,7 @@ template <typename Tn> void python_export_global(const char *name, Tn &x) return; d = PyModule_GetDict(m); try { - py::object obj = py::cast(x); + py::object obj = py::cast(x, py::return_value_policy::reference); PyDict_SetItemString(d, name, obj.ptr()); } catch (py::error_already_set const &) { // Parse and output the exception |