From 0f84be9d5b6e3087b458697c12505fb2460f9a34 Mon Sep 17 00:00:00 2001 From: Darius Tan Date: Sat, 12 Jun 2021 21:50:37 +1200 Subject: [PATCH] Set kp_debug, kp_info, kp_warning and kp_error to py::none() when the program terminates. --- python/src/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/python/src/main.cpp b/python/src/main.cpp index e05e19320..d9f87e93a 100644 --- a/python/src/main.cpp +++ b/python/src/main.cpp @@ -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;