Use assert_ne for checking thread initialization

This commit is contained in:
kngwyu 2020-12-20 15:52:10 +09:00 committed by David Hewitt
parent dc2dbd6c19
commit 839f13ea21

View file

@ -64,7 +64,7 @@ pub fn prepare_freethreaded_python() {
if ffi::Py_IsInitialized() != 0 { if ffi::Py_IsInitialized() != 0 {
// If Python is already initialized, we expect Python threading to also be initialized, // If Python is already initialized, we expect Python threading to also be initialized,
// as we can't make the existing Python main thread acquire the GIL. // as we can't make the existing Python main thread acquire the GIL.
debug_assert_ne!(ffi::PyEval_ThreadsInitialized(), 0); assert_ne!(ffi::PyEval_ThreadsInitialized(), 0);
} else { } else {
// Initialize Python. // Initialize Python.
// We use Py_InitializeEx() with initsigs=0 to disable Python signal handling. // We use Py_InitializeEx() with initsigs=0 to disable Python signal handling.