proper ctx export

This commit is contained in:
Miodrag Milanovic 2020-07-23 20:20:26 +02:00
parent cca7d3aef7
commit 8a90328ab7
2 changed files with 2 additions and 2 deletions

View File

@ -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>())

View File

@ -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