From 5d3fc8541f3dbdd70f9011d88ccf5e7dd117baac Mon Sep 17 00:00:00 2001 From: Kyle Dayton Date: Sun, 18 May 2025 20:13:17 -0500 Subject: [PATCH] pkbind::finalize is corrected --- include/pybind11/pybind11.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 5244cc6f..3fc72775 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -20,15 +20,19 @@ inline void initialize(int object_pool_size = 1024) { /// finalize the vm. inline void finalize(bool test = false) { if(!initialized) { return; } + object_pool::finalize(); type::m_type_map.clear(); capsule::tp_capsule.reset(); cpp_function::tp_function_record.reset(); + if(test) { py_resetvm(); } else { py_finalize(); } + + initialized = false; } /// a RAII class to initialize and finalize python interpreter @@ -41,4 +45,4 @@ public: } // namespace pkbind -namespace pybind11 = pkbind; \ No newline at end of file +namespace pybind11 = pkbind;