Skip to content

Commit e26017e

Browse files
tornariadimpase
authored andcommitted
test the custom signal handler with cypari2
This test triggers the following bug on cysignals 1.12.0 - 1.12.2: ``` Python 3.13.1 (main, Dec 14 2024, 12:44:03) [GCC 13.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import cypari2 >>> from cysignals.alarm import alarm >>> try: ... alarm(0.5) ... while True: pass ... except: ... pass ... >>> cypari2.Pari() Traceback (most recent call last): File "<python-input-3>", line 1, in <module> cypari2.Pari() ~~~~~~~~~~~~^^ File "cypari2/pari_instance.pyx", line 471, in cypari2.pari_instance.Pari.__cinit__ File "cypari2/closure.pyx", line 138, in cypari2.closure._pari_init_closure cysignals.signals.AlarmInterrupt ```
1 parent 0ba9995 commit e26017e

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ requires-python = ">=3.9"
3434

3535
[tool.pytest.ini_options]
3636
addopts = "--doctest-modules --import-mode importlib"
37-
norecursedirs = "builddir docs example"
37+
testpaths = "src tests"

tests/test_custom_signals.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import pytest
2+
import time
3+
4+
def test_clear_pending():
5+
6+
from cysignals.alarm import alarm, AlarmInterrupt
7+
8+
cypari2 = pytest.importorskip("cypari2")
9+
10+
with pytest.raises(AlarmInterrupt):
11+
alarm(0.5)
12+
time.sleep(1)
13+
14+
try:
15+
cypari2.Pari()
16+
except AlarmInterrupt:
17+
pytest.fail("AlarmInterrupt was not cleared")

0 commit comments

Comments
 (0)