From 8305bc3121bbe2932b3da660a043d33fac301d8e Mon Sep 17 00:00:00 2001 From: Jonathan Kliem Date: Mon, 30 May 2022 19:58:48 +0200 Subject: [PATCH 1/4] test with new cysignals version --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fffbd4f..bc997f9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,7 +35,8 @@ jobs: bash -x .travis-install-pari.sh - name: Local build run: | - pip install sphinx cython cysignals + pip install sphinx cython + pip install git+http://github.com/sagemath/cysignals.git@general_signal_hook#egg=cysignals make build make install make check From c95556fea592cac0665aacc0a02fe777281938b3 Mon Sep 17 00:00:00 2001 From: Jonathan Kliem Date: Mon, 30 May 2022 20:06:02 +0200 Subject: [PATCH 2/4] call cysignals hook --- cypari2/__init__.py | 3 +++ cypari2/custom_block.pyx | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 cypari2/custom_block.pyx diff --git a/cypari2/__init__.py b/cypari2/__init__.py index 1700c12..dbbade7 100644 --- a/cypari2/__init__.py +++ b/cypari2/__init__.py @@ -1,3 +1,6 @@ from .pari_instance import Pari from .handle_error import PariError from .gen import Gen +from .custom_block import init_custom_block + +init_custom_block() diff --git a/cypari2/custom_block.pyx b/cypari2/custom_block.pyx new file mode 100644 index 0000000..ded0908 --- /dev/null +++ b/cypari2/custom_block.pyx @@ -0,0 +1,27 @@ +# distutils: libraries = gmp pari + +#***************************************************************************** +# Distributed under the terms of the GNU General Public License (GPL) +# as published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# http://www.gnu.org/licenses/ +#***************************************************************************** + +from cysignals.signals cimport add_custom_signals + +cdef extern from "pari/pari.h": + int PARI_SIGINT_block, PARI_SIGINT_pending + +cdef int custom_signal_is_blocked(): + return PARI_SIGINT_block + +cdef void custom_signal_unblock(): + PARI_SIGINT_block = 0 + +cdef void custom_set_pending_signal(int sig): + PARI_SIGINT_pending = sig + +def init_custom_block(): + add_custom_signals(&custom_signal_is_blocked, + &custom_signal_unblock, + &custom_set_pending_signal) From a10cad3868bac5711170b7cebadf644fcc0dca5e Mon Sep 17 00:00:00 2001 From: Jonathan Kliem Date: Tue, 31 May 2022 16:09:56 +0200 Subject: [PATCH 3/4] specify that variables are global --- cypari2/custom_block.pyx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cypari2/custom_block.pyx b/cypari2/custom_block.pyx index ded0908..ddbb829 100644 --- a/cypari2/custom_block.pyx +++ b/cypari2/custom_block.pyx @@ -16,9 +16,11 @@ cdef int custom_signal_is_blocked(): return PARI_SIGINT_block cdef void custom_signal_unblock(): + global PARI_SIGINT_block PARI_SIGINT_block = 0 cdef void custom_set_pending_signal(int sig): + global PARI_SIGINT_pending PARI_SIGINT_pending = sig def init_custom_block(): From f8cb3306639e4c45612f988866efc73bec1e9bb4 Mon Sep 17 00:00:00 2001 From: Jonathan Kliem Date: Thu, 2 Jun 2022 14:43:28 +0200 Subject: [PATCH 4/4] bump version --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index eca07e4..8879483 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.1.2 +2.2.0a0