diff --git a/pyo3-macros-backend/src/module.rs b/pyo3-macros-backend/src/module.rs index 9537d66ac41..caa42a22ae8 100644 --- a/pyo3-macros-backend/src/module.rs +++ b/pyo3-macros-backend/src/module.rs @@ -355,7 +355,8 @@ pub fn pymodule_module_impl( options.submodule.is_some(), options .supports_free_threaded - .is_some_and(|op| op.value.value), + .map(|op| op.value.value) + .unwrap_or(false), ); Ok(quote!( diff --git a/src/types/module.rs b/src/types/module.rs index cc864711111..e0069096d18 100644 --- a/src/types/module.rs +++ b/src/types/module.rs @@ -560,6 +560,7 @@ impl<'py> PyModuleMethods<'py> for Bound<'py, PyModule> { 0..=c_int::MAX => Ok(()), } } + #[cfg(any(Py_LIMITED_API, not(Py_GIL_DISABLED)))] Ok(()) } }