Merge pull request #231 from thinking-tower/bugfix/segfault-after-import-kp-and-exit

Set kp_debug, kp_info, kp_warning and kp_error to py::none() when the program terminates.
This commit is contained in:
Alejandro Saucedo 2021-06-12 11:49:05 +01:00 committed by GitHub
commit e77a684a20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -235,6 +235,13 @@ PYBIND11_MODULE(kp, m) {
return kp::py::vkPropertiesToDict(properties);
}, "Return a dict containing information about the device");
auto atexit = py::module_::import("atexit");
atexit.attr("register")(py::cpp_function([](){
kp_debug = py::none();
kp_info = py::none();
kp_warning = py::none();
kp_error = py::none();
}));
#ifdef VERSION_INFO
m.attr("__version__") = VERSION_INFO;