Skip to content

Commit

Permalink
Have pythran generate freethreading compatible code
Browse files Browse the repository at this point in the history
Fix #2258
  • Loading branch information
serge-sans-paille committed Nov 27, 2024
1 parent 075cefc commit 34bd810
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/freethreading.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Kept seperate from core.yml because it uses a quantsight-built python setup
name: freethreading

on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.13t"]
cpp-version: [g++-8, clang-7]
steps:
- uses: actions/checkout@v2
- name: Install native dependencies
run: |
sudo apt install ${{ matrix.cpp-version }}
sudo apt install libopenblas-dev # for meson integration testing
- name: Setup Python ${{ matrix.python-version }}
uses: quansight-labs/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install scipy-openblas64
pip install pytest-xdist
- name: Setup
run: |
python -m pip install .
python -m pip install . 'pythran[test]'
printf '[compiler]\nblas=scipy-openblas\n' > ~/.config/.pythranrc
printf 'cflags=-std=c++11 -Wall -Werror -Wno-unknown-pragmas -Wno-unused-local-typedefs -Wno-cpp -Wno-deprecated-declarations' >> ~/.config/.pythranrc
if test "${{ matrix.cpp-version }}" = "clang-7" ; then printf -- " -Wno-absolute-value -Wno-parentheses-equality\n" ; else printf "\n" ; fi >> ~/.config/.pythranrc
- name: Testing minimal CLI
run: |
pythran --version
pythran --help
pythran-config -vvv
- name: Testing sequential
run: |
export CC=`echo ${{ matrix.cpp-version }} | sed -e 's/g++/gcc/'`
export CXX=`echo ${{ matrix.cpp-version }} | sed -e 's/clang/clang++/'`
pytest pythran/tests/test_*.py -v -x --numprocesses=auto $PYTEST_ARGS
3 changes: 3 additions & 0 deletions pythran/cxxgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,9 @@ def __str__(self):
theDoc);
{extraobjects}
#ifdef Py_GIL_DISABLED
PyUnstable_Module_SetGIL(theModule, Py_MOD_GIL_NOT_USED);
#endif
PYTHRAN_RETURN;
}}
'''.format(name=self.name,
Expand Down

0 comments on commit 34bd810

Please sign in to comment.