Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
890fcb3
initial thread safety work
kumaraditya303 Jun 3, 2025
7e7850a
add todos
kumaraditya303 Jun 3, 2025
af12dff
wip
kumaraditya303 Jun 5, 2025
9c22e4c
wip
kumaraditya303 Jun 5, 2025
c923d4c
Merge branch 'realize-threadsafe' into thread-safe2
kumaraditya303 Jun 5, 2025
8afaeb4
Merge branch 'realize-threadsafe' into thread-safe2
kumaraditya303 Jun 5, 2025
1c239c9
Merge branch 'realize-threadsafe' into thread-safe2
kumaraditya303 Jun 5, 2025
7edf689
fix do_realize_lazy_struct
kumaraditya303 Jun 5, 2025
e26b063
add cs
kumaraditya303 Jun 5, 2025
db3d6be
fix enum
kumaraditya303 Jun 5, 2025
7ea6846
fix wofk
kumaraditya303 Jun 5, 2025
e77b2f1
fix thread safety of enum
kumaraditya303 Jun 5, 2025
e19939a
cleanup
kumaraditya303 Jun 5, 2025
ae0f572
fix gil builds
kumaraditya303 Jun 5, 2025
f1d8711
Merge branch 'realize-enum' into thread-safe2
kumaraditya303 Jun 5, 2025
75187f1
initialize atomic fields in ctypdescr_new
ngoldbaum Jun 5, 2025
68cb2aa
add cpython suppression
ngoldbaum Jun 5, 2025
e85739f
cleanups
ngoldbaum Jun 5, 2025
7afb469
move CT_WITH_VAR_ARRAY to ct_flags_mut
ngoldbaum Jun 5, 2025
220c156
adjust TSAN suppression
ngoldbaum Jun 6, 2025
3848dd4
Initialization fixes and cleanups
kumaraditya303 Jun 6, 2025
127ed46
Merge branch 'thread-safe2' of https://github.com/kumaraditya303/cffi…
kumaraditya303 Jun 6, 2025
9918b59
fix test_new_handle_cycle
kumaraditya303 Jun 6, 2025
cae0511
mark test_ffi_type_not_immortal as thread unsafe
kumaraditya303 Jun 6, 2025
dc55274
fix do_realize_lazy_struct
kumaraditya303 Jun 6, 2025
de42b8c
mark pkgconfig test as thread unsafe
kumaraditya303 Jun 6, 2025
74ffb9c
fix win
kumaraditya303 Jun 6, 2025
665847a
skip more thread unsafe tests
kumaraditya303 Jun 6, 2025
30174f9
fix direct_newp
kumaraditya303 Jun 6, 2025
5fb4070
add ct_unrealized_struct_or_union (#3)
ngoldbaum Jun 7, 2025
f38ee04
use atomics for ct_size
kumaraditya303 Jun 7, 2025
48cbbf2
fix is completed checks
kumaraditya303 Jun 7, 2025
9ede0ef
fix direct_newp
kumaraditya303 Jun 7, 2025
646df44
fix size
kumaraditya303 Jun 7, 2025
098e62b
fix size
kumaraditya303 Jun 7, 2025
b189b02
fix compilation
kumaraditya303 Jun 7, 2025
2f3b2ef
Merge branch 'main' of https://github.com/Quansight-Labs/cffi into th…
kumaraditya303 Jun 8, 2025
b448210
fix lib_build_cpython_func
kumaraditya303 Jun 8, 2025
e736806
fix nogil builds
kumaraditya303 Jun 8, 2025
6f9eabc
Merge branch 'main' of https://github.com/Quansight-Labs/cffi into th…
kumaraditya303 Jun 8, 2025
052dd55
remove ct_flags_mut in favor of atomic flags
kumaraditya303 Jun 8, 2025
9a91992
fix couple of data races with missing atomic loads
kumaraditya303 Jun 9, 2025
1922ecc
fix for 3.13 avoid going through parking lot
kumaraditya303 Jun 10, 2025
7608191
Add pytest-run-parallel/TSAN CI (#5)
ngoldbaum Jun 11, 2025
4cbf8fb
Merge branch 'main' of https://github.com/Quansight-Labs/cffi into th…
kumaraditya303 Jun 11, 2025
a18d0b4
unskip some tests
kumaraditya303 Jun 11, 2025
e384373
remove cp313t-macosx_x86_64 and cp313t-macosx_arm64
kumaraditya303 Jun 11, 2025
dcb3f3e
pin cibuildwheel==2.23.3
kumaraditya303 Jun 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 107 additions & 31 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
rm -rf dist/
python -m pip install build
python -m build --sdist

echo "sdist_artifact_name=$(ls ./dist)" >> "$GITHUB_OUTPUT"
echo "package_version=$(ls ./dist | sed -En 's/cffi-(.+)\.tar\.gz/\1/p')" >> "$GITHUB_OUTPUT"

Expand Down Expand Up @@ -76,20 +76,20 @@ jobs:

- spec: cp39-manylinux_x86_64
omit: ${{ env.skip_ci_redundant_jobs }}

- spec: cp310-manylinux_x86_64
omit: ${{ env.skip_ci_redundant_jobs }}

- spec: cp311-manylinux_x86_64
omit: ${{ env.skip_ci_redundant_jobs }}

- spec: cp312-manylinux_x86_64
omit: ${{ env.skip_ci_redundant_jobs }}

- spec: cp313-manylinux_x86_64

- spec: cp313t-manylinux_x86_64

- spec: cp38-manylinux_i686
omit: ${{ env.skip_ci_redundant_jobs }}

Expand All @@ -107,10 +107,13 @@ jobs:

- spec: cp313-manylinux_i686
omit: ${{ env.skip_ci_redundant_jobs }}


- spec: cp313t-manylinux_i686
omit: ${{ env.skip_ci_redundant_jobs }}

- spec: cp39-musllinux_x86_64
omit: ${{ env.skip_ci_redundant_jobs }}

- spec: cp310-musllinux_x86_64
omit: ${{ env.skip_ci_redundant_jobs }}

Expand All @@ -119,9 +122,11 @@ jobs:

- spec: cp312-musllinux_x86_64
omit: ${{ env.skip_ci_redundant_jobs }}

- spec: cp313-musllinux_x86_64


- spec: cp313t-musllinux_x86_64

- spec: cp39-musllinux_i686
omit: ${{ env.skip_ci_redundant_jobs }}

Expand All @@ -133,14 +138,14 @@ jobs:

#- spec: cp312-musllinux_i686 # busted as of 2024-05-17
# omit: ${{ env.skip_ci_redundant_jobs }}

#- spec: cp313-musllinux_i686 # busted as of 2024-05-17

- spec: cp39-musllinux_aarch64
foreign_arch: true
test_args: '{package}/src/c'
omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }}

- spec: cp310-musllinux_aarch64
foreign_arch: true
test_args: '{package}/src/c'
Expand All @@ -155,12 +160,17 @@ jobs:
foreign_arch: true
test_args: '{package}/src/c'
omit: ${{ env.skip_ci_redundant_jobs || env.skip_slow_jobs }}

- spec: cp313-musllinux_aarch64
foreign_arch: true
# test_args: '{package}/src/c'
omit: ${{ env.skip_slow_jobs}}


- spec: cp313t-musllinux_aarch64
foreign_arch: true
# test_args: '{package}/src/c'
omit: ${{ env.skip_slow_jobs}}

- spec: cp38-manylinux_aarch64
foreign_arch: true
test_args: '{package}/src/c'
Expand All @@ -185,12 +195,17 @@ jobs:
foreign_arch: true
test_args: '{package}/src/c'
omit: ${{ env.skip_slow_jobs || env.skip_ci_redundant_jobs }}

- spec: cp313-manylinux_aarch64
foreign_arch: true
# test_args: '{package}/src/c'
omit: ${{ env.skip_slow_jobs }}


- spec: cp313t-manylinux_aarch64
foreign_arch: true
# test_args: '{package}/src/c'
omit: ${{ env.skip_slow_jobs }}

- spec: cp38-manylinux_ppc64le
foreign_arch: true
test_args: '{package}/src/c'
Expand Down Expand Up @@ -220,7 +235,12 @@ jobs:
foreign_arch: true
test_args: '{package}/src/c'
omit: ${{ env.skip_slow_jobs }}


- spec: cp313t-manylinux_ppc64le
foreign_arch: true
test_args: '{package}/src/c'
omit: ${{ env.skip_slow_jobs }}

- spec: cp38-manylinux_s390x
foreign_arch: true
test_args: '{package}/src/c'
Expand Down Expand Up @@ -251,6 +271,11 @@ jobs:
# test_args: '{package}/src/c'
omit: ${{ env.skip_slow_jobs }}

- spec: cp313t-manylinux_s390x
foreign_arch: true
# test_args: '{package}/src/c'
omit: ${{ env.skip_slow_jobs }}


linux:
needs: [python_sdist, make_linux_matrix]
Expand Down Expand Up @@ -301,11 +326,11 @@ jobs:
CIBW_TEST_COMMAND: PYTHONUNBUFFERED=1 python -m pytest ${{ matrix.test_args || '{project}' }} # default to test all
run: |
set -eux

mkdir cffi

tar zxf ${{ steps.fetch_sdist.outputs.download-path }}/cffi*.tar.gz --strip-components=1 -C cffi
python -m pip install --upgrade "${{ matrix.cibw_version || 'cibuildwheel' }}"
python -m pip install cibuildwheel==2.23.3

# actually build libffi + wheel (using env tweaks above)
python -m cibuildwheel --output-dir dist ./cffi
Expand Down Expand Up @@ -408,27 +433,28 @@ jobs:
- name: build wheel prereqs
run: |
set -eux
python3 -m pip install --user --upgrade "${{ matrix.cibw_version || 'cibuildwheel' }}"
python3 -m pip install --user --upgrade cibuildwheel==2.23.3
brew uninstall --ignore-dependencies libffi 2>&1 || true

- name: build/test wheels
id: build
env:
CIBW_BUILD: ${{ matrix.spec }}
CIBW_PRERELEASE_PYTHONS: 'True'
CIBW_FREE_THREADED_SUPPORT: 'True'
CIBW_TEST_REQUIRES: pytest setuptools
CIBW_TEST_COMMAND: pip install pip --upgrade; cd {project}; PYTHONUNBUFFERED=1 pytest
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.deployment_target || '10.9' }}
SDKROOT: ${{ matrix.sdkroot || 'macosx' }}
run: |
set -eux

mkdir cffi

tar zxf ${{ steps.fetch_sdist.outputs.download-path }}/cffi*.tar.gz --strip-components=1 -C cffi

python3 -m cibuildwheel --output-dir dist cffi

echo "artifact_name=$(ls ./dist/)" >> "$GITHUB_OUTPUT"

- name: upload artifacts
Expand Down Expand Up @@ -468,7 +494,8 @@ jobs:
omit: ${{ env.skip_ci_redundant_jobs }}

- spec: cp313-win_amd64
# omit: ${{ env.skip_ci_redundant_jobs }}

- spec: cp313t-win_amd64

- spec: cp38-win32
omit: ${{ env.skip_ci_redundant_jobs }}
Expand All @@ -488,6 +515,9 @@ jobs:
- spec: cp313-win32
omit: ${{ env.skip_ci_redundant_jobs }}

- spec: cp313t-win32
omit: ${{ env.skip_ci_redundant_jobs }}

windows:
needs: [python_sdist, make_windows_matrix]
runs-on: windows-2022
Expand All @@ -507,21 +537,22 @@ jobs:
env:
CIBW_BUILD: ${{ matrix.spec }}
CIBW_PRERELEASE_PYTHONS: 'True'
CIBW_FREE_THREADED_SUPPORT: 'True'
CIBW_TEST_REQUIRES: pytest setuptools
CIBW_TEST_COMMAND: 'python -m pytest {package}/src/c'
# FIXME: /testing takes ~45min on Windows and has some failures...
# CIBW_TEST_COMMAND='python -m pytest {package}/src/c {project}/testing'
run: |
set -eux

mkdir cffi

tar zxf cffi*.tar.gz --strip-components=1 -C cffi

python -m pip install --upgrade pip
pip install "${{ matrix.cibw_version || 'cibuildwheel'}}"
pip install cibuildwheel==2.23.3
python -m cibuildwheel --output-dir dist cffi

echo "artifact_name=$(ls ./dist/)" >> "$GITHUB_OUTPUT"

shell: bash
Expand All @@ -545,10 +576,55 @@ jobs:
delete-merged: true
if: ${{ env.skip_artifact_upload != 'true' }}

pytest-run-parallel:
strategy:
matrix:
runner-image: ['ubuntu-latest', 'macos-latest', 'windows-latest']
python-version: ['3.13t', '3.14t-dev']
runs-on: ${{ matrix.runner-image }}
steps:
- name: clone repo
uses: actions/checkout@v4

- name: install python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: build and install
run: |
python -m pip install pytest setuptools pytest-run-parallel
python -m pip install .

- name: run tests under pytest-run-parallel
if: runner.os == 'Windows'
run: |
python -m pytest --parallel-threads=4 src/c

- name: run tests under pytest-run-parallel
if: runner.os != 'Windows'
run: |
python -m pytest --parallel-threads=4

clang_TSAN:
runs-on: ubuntu-latest
container: ghcr.io/nascheme/numpy-tsan:3.14t
steps:
- uses: actions/checkout@v4

- name: build and install
run: |
python -m pip install setuptools pytest pytest-run-parallel
CFLAGS="-g -O3 -fsanitize=thread" python -m pip install -v .

- name: run tests under pytest-run-parallel
run: |
TSAN_OPTIONS="suppressions=$PWD/suppressions_free_threading.txt" \
python -m pytest --parallel-threads=4 --skip-thread-unsafe=True -sv

check:
if: always()
needs: [python_sdist, linux, macos, windows, merge_artifacts]
needs: [python_sdist, linux, macos, windows, clang_TSAN, pytest-run-parallel, merge_artifacts]
runs-on: ubuntu-latest
steps:
- name: Verify all previous jobs succeeded (provides a single check to sample for gating purposes)
Expand Down
Loading
Loading