proper ctx export
This commit is contained in:
parent
cca7d3aef7
commit
8a90328ab7
@ -145,7 +145,7 @@ PYBIND11_MODULE(MODULE_NAME, m)
|
|||||||
typedef std::unordered_map<IdString, IdString> IdIdMap;
|
typedef std::unordered_map<IdString, IdString> IdIdMap;
|
||||||
typedef std::unordered_map<IdString, std::unique_ptr<Region>> RegionMap;
|
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")
|
auto loc_cls = py::class_<Loc>(m, "Loc")
|
||||||
.def(py::init<int, int, int>())
|
.def(py::init<int, int, int>())
|
||||||
|
@ -45,7 +45,7 @@ template <typename Tn> void python_export_global(const char *name, Tn &x)
|
|||||||
return;
|
return;
|
||||||
d = PyModule_GetDict(m);
|
d = PyModule_GetDict(m);
|
||||||
try {
|
try {
|
||||||
py::object obj = py::cast(x);
|
py::object obj = py::cast(x, py::return_value_policy::reference);
|
||||||
PyDict_SetItemString(d, name, obj.ptr());
|
PyDict_SetItemString(d, name, obj.ptr());
|
||||||
} catch (py::error_already_set const &) {
|
} catch (py::error_already_set const &) {
|
||||||
// Parse and output the exception
|
// Parse and output the exception
|
||||||
|
Loading…
Reference in New Issue
Block a user