Skip to content

Commit 1744d6c

Browse files
authored
test(threading): skip scratch contention under freethreading (#225)
1 parent 877373f commit 1744d6c

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

.github/workflows/build.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,16 @@ jobs:
5353
# 4. The event is specifically on the 'darvid/python-hyperscan'
5454
# repository AND the commit message contains '[build]'.
5555
if: >
56-
(github.event_name != 'push' || github.repository == 'darvid/python-hyperscan') &&
57-
((github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository) || (github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, vars.RELEASE_PR_BRANCH || 'create-pull-request'))) ||
58-
(github.repository == 'darvid/python-hyperscan' && contains(github.event.head_commit.message, '[build]'))
56+
github.event_name == 'pull_request' ||
57+
github.event_name == 'workflow_dispatch' ||
58+
github.event_name == 'workflow_call' ||
59+
(
60+
github.event_name == 'push' &&
61+
(
62+
github.repository == 'darvid/python-hyperscan' ||
63+
contains(github.event.head_commit.message, '[build]')
64+
)
65+
)
5966
run: |
6067
echo "valid_event=true" >> "$GITHUB_OUTPUT"
6168

tests/test_threading.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import concurrent.futures
2+
import sys
23
import threading
34
from typing import List, Tuple
45

@@ -26,6 +27,8 @@ def test_shared_scratch_rejected_concurrent_scan(threaded_database):
2627
Hyperscan and Vectorscan require each concurrent scan to run against its own
2728
scratch space; sharing a scratch between threads is explicitly unsupported.
2829
"""
30+
if not getattr(sys, "_is_gil_enabled", lambda: True)():
31+
pytest.skip("Scratch contention not observable under free-threaded CPython yet")
2932

3033
db = threaded_database
3134
shared_scratch = hyperscan.Scratch(db)

0 commit comments

Comments
 (0)