diff --git a/src/gil.rs b/src/gil.rs index 8d04641063e..ebbf069de6e 100644 --- a/src/gil.rs +++ b/src/gil.rs @@ -529,8 +529,17 @@ fn decrement_gil_count() { mod tests { use super::*; - use crate::{types::any::PyAnyMethods, PyObject}; - + use crate::types::any::PyAnyMethods; + #[cfg(any( + feature = "gil-refs", + all(not(pyo3_disable_reference_pool), not(target_arch = "wasm32")) // We are building wasm Python with pthreads disabled + ))] + use crate::PyObject; + + #[cfg(any( + feature = "gil-refs", + all(not(pyo3_disable_reference_pool), not(target_arch = "wasm32")) // We are building wasm Python with pthreads disabled + ))] fn get_object(py: Python<'_>) -> PyObject { py.eval_bound("object()", None, None).unwrap().unbind() } @@ -622,6 +631,7 @@ mod tests { } #[test] + #[cfg(all(not(pyo3_disable_reference_pool), not(target_arch = "wasm32")))] // We are building wasm Python with pthreads disabled fn test_pyobject_drop_with_gil_decreases_refcnt() { Python::with_gil(|py| { let obj = get_object(py);