diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3cc1413..bfafaf2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,17 +68,14 @@ jobs: submodules: recursive fetch-depth: 0 - name: Set up Cygwin - uses: egor-tensin/setup-cygwin@v4 + uses: dimpase/setup-cygwin@v5 with: - packages: gcc-core gcc-g++ python3${{ matrix.python-version }}-devel ninja pkgconf - - name: Install dependencies + packages: gcc-core gcc-g++ python3${{ matrix.python-version }}-devel ninja pkgconf meson + - name: Install dependencies, build and check shell: C:\tools\cygwin\bin\bash.exe --norc -eo pipefail -o igncr '{0}' run: | python3.${{ matrix.python-version }} -m pip install --upgrade pip - python3.${{ matrix.python-version }} -m pip install --upgrade -r ./requirements.txt - - name: Build and check - shell: C:\tools\cygwin\bin\bash.exe --norc -eo pipefail -o igncr '{0}' - run: | + pip install --upgrade -r ./requirements.txt pip install --no-build-isolation --config-settings=builddir=builddir . meson test --print-errorlogs -C builddir diff --git a/pyproject.toml b/pyproject.toml index d30ad23..edcb5c8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,4 +34,4 @@ requires-python = ">=3.9" [tool.pytest.ini_options] addopts = "--doctest-modules --import-mode importlib" -norecursedirs = "builddir docs example" +testpaths = "src tests" diff --git a/src/cysignals/implementation.c b/src/cysignals/implementation.c index 20a83d0..18b8144 100644 --- a/src/cysignals/implementation.c +++ b/src/cysignals/implementation.c @@ -591,7 +591,7 @@ static void _sig_on_interrupt_received(void) do_raise_exception(cysigs.interrupt_received); cysigs.sig_on_count = 0; cysigs.interrupt_received = 0; - custom_signal_unblock(); + custom_set_pending_signal(0); #if HAVE_SIGPROCMASK sigprocmask(SIG_SETMASK, &oldset, NULL); diff --git a/tests/test_custom_signals.py b/tests/test_custom_signals.py new file mode 100644 index 0000000..0afc36f --- /dev/null +++ b/tests/test_custom_signals.py @@ -0,0 +1,23 @@ +""" +Tests for custom signals. +""" + +import time +import pytest + +def test_clear_pending(): + """ + Regression test for https://github.com/sagemath/cysignals/pull/216 + """ + + alarm = pytest.importorskip("cysignals.alarm") # n/a on windows + cypari2 = pytest.importorskip("cypari2") + + with pytest.raises(alarm.AlarmInterrupt): + alarm.alarm(0.01) + time.sleep(1) + + try: + cypari2.Pari() + except alarm.AlarmInterrupt: + pytest.fail("AlarmInterrupt was not cleared")