[mod_python3] Replace previously removed deprecated calls

This commit is contained in:
Marc Olivier Chouinard 2021-10-20 20:16:39 -04:00 committed by GitHub
parent f26522f102
commit 578024ed86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -574,7 +574,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_python3_load)
// swap out threadstate since the call threads will create
// their own and swap in their threadstate
PyThreadState_Swap(NULL);
// and release the global interpreter lock
PyEval_SaveThread();
}
switch_mutex_init(&THREAD_POOL_LOCK, SWITCH_MUTEX_NESTED, pool);
@ -619,6 +621,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_python3_shutdown)
pt = nextpt;
}
PyThreadState_Swap(mainThreadState);
PyEval_ReleaseThread(mainThreadState);
switch_yield(1000000);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Had to kill %d threads\n", thread_cnt);
@ -644,9 +647,13 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_python3_shutdown)
mainInterpreterState = mainThreadState->interp;
myThreadState = PyThreadState_New(mainInterpreterState);
PyThreadState_Swap(myThreadState);
PyEval_ReleaseThread(myThreadState);
Py_Finalize();
// Release the global interpreter lock
PyEval_SaveThread();
return SWITCH_STATUS_UNLOAD;
}