Skip to content

Commit

Permalink
Remove PARI
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Jun 9, 2024
1 parent 035ed16 commit 437d0c6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 33 deletions.
7 changes: 6 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ Requirements
- Python >= 3.6
- Cython >= 0.28
- Sphinx >= 1.6 (for building the documentation)
- PARI/GP (optional; for interfacing with the PARI/GP signal handler)

Links
-----
Expand All @@ -43,6 +42,12 @@ Links
Changelog
---------

1.12.0 (unreleased)
^^^^^^^^^^^^^^^^^^^

* Remove optional compile-time dependency on PARI/GP. [#166]


1.11.4 (2023-10-07)
^^^^^^^^^^^^^^^^^^^

Expand Down
17 changes: 0 additions & 17 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ AC_CONFIG_FILES([src/cysignals/signals.pxd])

AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug], [enable debug output]))
AC_ARG_WITH(pari,
AS_HELP_STRING([--without-pari], [build without PARI support]))

if test "$enable_debug" = yes; then
AC_DEFINE([ENABLE_DEBUG_CYSIGNALS], 1, [Enable debug output])
Expand All @@ -30,21 +28,6 @@ AC_PROG_CXX()
AC_CHECK_HEADERS([execinfo.h sys/mman.h sys/prctl.h time.h sys/wait.h windows.h])
AC_CHECK_FUNCS([fork kill sigprocmask sigaltstack backtrace])


have_pari=no
if test "$with_pari" != "no"; then
AC_SEARCH_LIBS([pari_init], [pari], [
AC_CHECK_DECL([PARI_SIGINT_block],
[have_pari=yes], [],
[[#include <pari/pari.h>]])])
fi

if test "$have_pari" = "yes"; then
AC_DEFINE([HAVE_PARI], 1, [Define to 1 if PARI is fully supported.])
elif test "$with_pari" = "yes"; then
AC_MSG_ERROR([PARI support requested but PARI was not found])
fi

AC_MSG_CHECKING([for emms instruction])
# We add the "leal" instruction to reduce false positives in case some
# non-x86 architecture also has an "emms" instruction.
Expand Down
16 changes: 1 addition & 15 deletions src/cysignals/implementation.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,6 @@ Interrupt and signal handling for Cython
#include <sys/prctl.h>
#endif
#include <Python.h>
#if HAVE_PARI
#include <pari/pari.h>
#else
/* Fake PARI variables */
static int PARI_SIGINT_block = 0;
static int PARI_SIGINT_pending = 0;
#define paricfg_version NULL
#endif

// Custom signal handling of other packages.
#define MAX_N_CUSTOM_HANDLERS 16
Expand Down Expand Up @@ -94,8 +86,6 @@ void custom_set_pending_signal(int sig){
}

#if HAVE_WINDOWS_H
/* We must include <windows.h> after <pari.h>
* See https://github.com/sagemath/cysignals/issues/107 */
#include <windows.h>
#endif
#include "struct_signals.h"
Expand Down Expand Up @@ -295,7 +285,7 @@ static void cysigs_interrupt_handler(int sig)

if (cysigs.sig_on_count > 0)
{
if (!cysigs.block_sigint && !PARI_SIGINT_block && !custom_signal_is_blocked())
if (!cysigs.block_sigint && !custom_signal_is_blocked())
{
/* Raise an exception so Python can see it */
do_raise_exception(sig);
Expand All @@ -318,7 +308,6 @@ static void cysigs_interrupt_handler(int sig)
if (cysigs.interrupt_received != SIGHUP && cysigs.interrupt_received != SIGTERM)
{
cysigs.interrupt_received = sig;
PARI_SIGINT_pending = sig;
custom_set_pending_signal(sig);
}
}
Expand Down Expand Up @@ -486,7 +475,6 @@ static void _sig_on_interrupt_received(void)
do_raise_exception(cysigs.interrupt_received);
cysigs.sig_on_count = 0;
cysigs.interrupt_received = 0;
PARI_SIGINT_pending = 0;
custom_signal_unblock();

#if HAVE_SIGPROCMASK
Expand All @@ -499,11 +487,9 @@ static void _sig_on_interrupt_received(void)
static void _sig_on_recover(void)
{
cysigs.block_sigint = 0;
PARI_SIGINT_block = 0;
custom_signal_unblock();
cysigs.sig_on_count = 0;
cysigs.interrupt_received = 0;
PARI_SIGINT_pending = 0;
custom_set_pending_signal(0);

#if HAVE_SIGPROCMASK
Expand Down

0 comments on commit 437d0c6

Please sign in to comment.