mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-11 08:03:55 +00:00
This reverts commit b2c1978caa
.
See #4500 for background.
This commit is contained in:
parent
8a90b36772
commit
f8713ec43e
@ -254,16 +254,13 @@ inline void finalize_interpreter() {
|
|||||||
if (builtins.contains(id) && isinstance<capsule>(builtins[id])) {
|
if (builtins.contains(id) && isinstance<capsule>(builtins[id])) {
|
||||||
internals_ptr_ptr = capsule(builtins[id]);
|
internals_ptr_ptr = capsule(builtins[id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_Finalize();
|
|
||||||
|
|
||||||
// Local internals contains data managed by the current interpreter, so we must clear them to
|
// Local internals contains data managed by the current interpreter, so we must clear them to
|
||||||
// avoid undefined behaviors when initializing another interpreter
|
// avoid undefined behaviors when initializing another interpreter
|
||||||
// Must be cleared only after Py_Finalize() so atexit and other hooks can still use
|
|
||||||
// registered_types
|
|
||||||
detail::get_local_internals().registered_types_cpp.clear();
|
detail::get_local_internals().registered_types_cpp.clear();
|
||||||
detail::get_local_internals().registered_exception_translators.clear();
|
detail::get_local_internals().registered_exception_translators.clear();
|
||||||
|
|
||||||
|
Py_Finalize();
|
||||||
|
|
||||||
if (internals_ptr_ptr) {
|
if (internals_ptr_ptr) {
|
||||||
delete *internals_ptr_ptr;
|
delete *internals_ptr_ptr;
|
||||||
*internals_ptr_ptr = nullptr;
|
*internals_ptr_ptr = nullptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user