void python_end() { static int recurse = 0; /* If a crash occurs while doing this, don't try again. */ if (recurse != 0) return; ++recurse; #ifdef DYNAMIC_PYTHON if (hinstPython && Py_IsInitialized()) { Python_RestoreThread(); /* enter python */ Py_Finalize(); } end_dynamic_python(); #else if (Py_IsInitialized()) { Python_RestoreThread(); /* enter python */ Py_Finalize(); } #endif --recurse; }
void python_end(void) { static int recurse = 0; /* If a crash occurs while doing this, don't try again. */ if (recurse != 0) return; python_end_called = TRUE; ++recurse; #ifdef DYNAMIC_PYTHON if (hinstPython && Py_IsInitialized()) { # ifdef PY_CAN_RECURSE PyGILState_Ensure(); # else Python_RestoreThread(); /* enter python */ # endif Py_Finalize(); } end_dynamic_python(); #else if (Py_IsInitialized()) { # ifdef PY_CAN_RECURSE PyGILState_Ensure(); # else Python_RestoreThread(); /* enter python */ # endif Py_Finalize(); } #endif --recurse; }