We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8a90b36 commit f8713ecCopy full SHA for f8713ec
include/pybind11/embed.h
@@ -254,16 +254,13 @@ inline void finalize_interpreter() {
254
if (builtins.contains(id) && isinstance<capsule>(builtins[id])) {
255
internals_ptr_ptr = capsule(builtins[id]);
256
}
257
-
258
- Py_Finalize();
259
260
// Local internals contains data managed by the current interpreter, so we must clear them to
261
// avoid undefined behaviors when initializing another interpreter
262
- // Must be cleared only after Py_Finalize() so atexit and other hooks can still use
263
- // registered_types
264
detail::get_local_internals().registered_types_cpp.clear();
265
detail::get_local_internals().registered_exception_translators.clear();
266
+ Py_Finalize();
+
267
if (internals_ptr_ptr) {
268
delete *internals_ptr_ptr;
269
*internals_ptr_ptr = nullptr;
0 commit comments