| 51 | std::vector<py::handle> &get_objects() { return objects; } |
| 52 | |
| 53 | static void init() { |
| 54 | // Ensure the singleton is created |
| 55 | auto &instance = get_instance(); |
| 56 | (void) instance; // suppress unused variable warning |
| 57 | assert(instance.objects.size() == 7); |
| 58 | // Register cleanup at interpreter exit |
| 59 | py::module_::import("atexit").attr("register")(py::cpp_function(&MySingleton::clear)); |
| 60 | } |
| 61 | |
| 62 | static void clear() { |
| 63 | auto &instance = get_instance(); |
nothing calls this directly
no test coverage detected