Skip to content

Commit 526517d

Browse files
committed
skip uvloop tests on free-threaded build
1 parent 8f19b3d commit 526517d

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ jobs:
125125
- name: Build
126126
run: cargo build --features=${{env.features}} --verbose --target ${{ matrix.platform.rust-target }}
127127

128-
# uvloop doesn't compile under Windows and PyPy
129-
- if: ${{ matrix.platform.os != 'windows-latest' && !startsWith(matrix.python-version, 'pypy') }}
128+
# uvloop doesn't compile under Windows and PyPy, nor for free-threaded Python
129+
- if: ${{ matrix.platform.os != 'windows-latest' && !startsWith(matrix.python-version, 'pypy') && !endsWith(matrix.python-version, 't') }}
130130
name: Install pyo3-asyncio test dependencies
131131
run: |
132132
python -m pip install -U uvloop

pytests/test_async_std_uvloop.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ fn main() -> pyo3::PyResult<()> {
44
pyo3::prepare_freethreaded_python();
55

66
Python::with_gil(|py| {
7+
// uvloop not supported on the free-threaded build yet
8+
// https://github.com/MagicStack/uvloop/issues/642
9+
let sysconfig = py.import("sysconfig")?;
10+
let is_freethreaded = sysconfig.call_method1("get_config_var", ("Py_GIL_DISABLED",))?;
11+
if is_freethreaded.is_truthy()? {
12+
return Ok(());
13+
}
14+
715
let uvloop = py.import("uvloop")?;
816
uvloop.call_method0("install")?;
917

pytests/test_tokio_current_thread_uvloop.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ fn main() -> pyo3::PyResult<()> {
1313
});
1414

1515
Python::with_gil(|py| {
16+
// uvloop not supported on the free-threaded build yet
17+
// https://github.com/MagicStack/uvloop/issues/642
18+
let sysconfig = py.import("sysconfig")?;
19+
let is_freethreaded = sysconfig.call_method1("get_config_var", ("Py_GIL_DISABLED",))?;
20+
if is_freethreaded.is_truthy()? {
21+
return Ok(());
22+
}
23+
1624
let uvloop = py.import("uvloop")?;
1725
uvloop.call_method0("install")?;
1826

pytests/test_tokio_multi_thread_uvloop.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ fn main() -> pyo3::PyResult<()> {
55
pyo3::prepare_freethreaded_python();
66

77
Python::with_gil(|py| {
8+
// uvloop not supported on the free-threaded build yet
9+
// https://github.com/MagicStack/uvloop/issues/642
10+
let sysconfig = py.import("sysconfig")?;
11+
let is_freethreaded = sysconfig.call_method1("get_config_var", ("Py_GIL_DISABLED",))?;
12+
if is_freethreaded.is_truthy()? {
13+
return Ok(());
14+
}
15+
816
let uvloop = py.import("uvloop")?;
917
uvloop.call_method0("install")?;
1018

0 commit comments

Comments
 (0)