mirror of
https://github.com/void-linux/void-packages.git
synced 2025-06-05 06:33:50 +02:00
python3-cysignals: update to 1.12.2.
This commit is contained in:
parent
f7c7332c30
commit
0b8f72c40c
5 changed files with 119 additions and 67 deletions
|
@ -0,0 +1,54 @@
|
||||||
|
Taken from https://github.com/sagemath/cysignals/pull/222
|
||||||
|
|
||||||
|
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")
|
51
srcpkgs/python3-cysignals/patches/222-fix_data_race.patch
Normal file
51
srcpkgs/python3-cysignals/patches/222-fix_data_race.patch
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
Taken from https://github.com/sagemath/cysignals/pull/222
|
||||||
|
|
||||||
|
diff --git a/src/cysignals/signals.pyx b/src/cysignals/signals.pyx
|
||||||
|
index 72f206e..96a99ad 100644
|
||||||
|
--- a/src/cysignals/signals.pyx
|
||||||
|
+++ b/src/cysignals/signals.pyx
|
||||||
|
@@ -25,7 +25,7 @@ See ``tests.pyx`` for extensive tests.
|
||||||
|
|
||||||
|
from libc.signal cimport *
|
||||||
|
from libc.stdio cimport freopen, stdin
|
||||||
|
-from cpython.ref cimport Py_XINCREF, Py_XDECREF
|
||||||
|
+from cpython.ref cimport Py_XINCREF, Py_CLEAR
|
||||||
|
from cpython.exc cimport (PyErr_Occurred, PyErr_NormalizeException,
|
||||||
|
PyErr_Fetch, PyErr_Restore)
|
||||||
|
from cpython.version cimport PY_MAJOR_VERSION
|
||||||
|
@@ -204,7 +204,7 @@ cdef int sig_raise_exception "sig_raise_exception"(int sig, const char* msg) exc
|
||||||
|
PyErr_Fetch(&typ, &val, &tb)
|
||||||
|
PyErr_NormalizeException(&typ, &val, &tb)
|
||||||
|
Py_XINCREF(val)
|
||||||
|
- Py_XDECREF(cysigs.exc_value)
|
||||||
|
+ Py_CLEAR(cysigs.exc_value)
|
||||||
|
cysigs.exc_value = val
|
||||||
|
PyErr_Restore(typ, val, tb)
|
||||||
|
|
||||||
|
@@ -362,8 +362,7 @@ cdef void verify_exc_value() noexcept:
|
||||||
|
"""
|
||||||
|
if cysigs.exc_value.ob_refcnt == 1:
|
||||||
|
# No other references => exception is certainly gone
|
||||||
|
- Py_XDECREF(cysigs.exc_value)
|
||||||
|
- cysigs.exc_value = NULL
|
||||||
|
+ Py_CLEAR(cysigs.exc_value)
|
||||||
|
return
|
||||||
|
|
||||||
|
if PyErr_Occurred() is not NULL:
|
||||||
|
@@ -394,8 +393,7 @@ cdef void verify_exc_value() noexcept:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
if <PyObject*>handled is cysigs.exc_value:
|
||||||
|
- Py_XDECREF(cysigs.exc_value)
|
||||||
|
- cysigs.exc_value = NULL
|
||||||
|
+ Py_CLEAR(cysigs.exc_value)
|
||||||
|
return
|
||||||
|
|
||||||
|
# To be safe, we run the garbage collector because it may clear
|
||||||
|
@@ -411,5 +409,4 @@ cdef void verify_exc_value() noexcept:
|
||||||
|
# called again during garbage collection it might have already been set
|
||||||
|
# to NULL; see https://github.com/sagemath/cysignals/issues/126
|
||||||
|
if cysigs.exc_value != NULL and cysigs.exc_value.ob_refcnt == 1:
|
||||||
|
- Py_XDECREF(cysigs.exc_value)
|
||||||
|
- cysigs.exc_value = NULL
|
||||||
|
+ Py_CLEAR(cysigs.exc_value)
|
|
@ -1,23 +0,0 @@
|
||||||
diff --git a/configure.ac b/configure.ac
|
|
||||||
index d0624ec..f5a6786 100644
|
|
||||||
--- a/configure.ac
|
|
||||||
+++ b/configure.ac
|
|
||||||
@@ -48,7 +48,7 @@ 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.
|
|
||||||
-AC_RUN_IFELSE([AC_LANG_PROGRAM([[]], [[asm("leal (%eax), %eax; emms");]])],
|
|
||||||
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[asm("leal (%eax), %eax; emms");]])],
|
|
||||||
dnl YES
|
|
||||||
[AC_MSG_RESULT([yes])]
|
|
||||||
AC_DEFINE(HAVE_EMMS, 1, [Define to 1 if your processor understands the "emms" instruction.])
|
|
||||||
@@ -84,6 +84,9 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM(
|
|
||||||
,
|
|
||||||
dnl NO
|
|
||||||
[AC_MSG_RESULT([no])]
|
|
||||||
+ ,
|
|
||||||
+ [AC_MSG_RESULT([cross, assume yes])]
|
|
||||||
+ sigsetjmp=yes
|
|
||||||
)
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([for GNU libc])
|
|
|
@ -1,22 +0,0 @@
|
||||||
diff --git a/src/cysignals/signals.pyx b/src/cysignals/signals.pyx
|
|
||||||
index 114a156..4bb7476 100644
|
|
||||||
--- a/src/cysignals/signals.pyx
|
|
||||||
+++ b/src/cysignals/signals.pyx
|
|
||||||
@@ -376,7 +376,7 @@ cdef void verify_exc_value() noexcept:
|
|
||||||
# to the exception.
|
|
||||||
try:
|
|
||||||
handled = sys.last_value
|
|
||||||
- except AttributeError:
|
|
||||||
+ except:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
if <PyObject*>handled is cysigs.exc_value:
|
|
||||||
@@ -388,7 +388,7 @@ cdef void verify_exc_value() noexcept:
|
|
||||||
# references to our exception.
|
|
||||||
try:
|
|
||||||
collect()
|
|
||||||
- except Exception:
|
|
||||||
+ except:
|
|
||||||
# This can happen when Python is shutting down and the gc module
|
|
||||||
# is not functional anymore.
|
|
||||||
pass
|
|
|
@ -1,33 +1,25 @@
|
||||||
# Template file for 'python3-cysignals'
|
# Template file for 'python3-cysignals'
|
||||||
pkgname=python3-cysignals
|
pkgname=python3-cysignals
|
||||||
version=1.11.4
|
version=1.12.2
|
||||||
revision=3
|
revision=1
|
||||||
# need gnu-configure build style to support cross build
|
build_style=python3-pep517
|
||||||
build_style=gnu-configure
|
build_helper=meson
|
||||||
build_helper=python3
|
hostmakedepends="python3-meson-python python3-Cython"
|
||||||
hostmakedepends="python3-setuptools python3-wheel python3-Cython
|
makedepends="python3-devel"
|
||||||
python3-build python3-installer autoconf"
|
|
||||||
makedepends="python3-devel pari-devel"
|
|
||||||
depends="python3"
|
depends="python3"
|
||||||
|
checkdepends="python3-pytest gdb"
|
||||||
short_desc="Interrupt and signal handling for Cython"
|
short_desc="Interrupt and signal handling for Cython"
|
||||||
maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
|
maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
|
||||||
license="LGPL-3.0-or-later"
|
license="LGPL-3.0-or-later"
|
||||||
homepage="https://github.com/sagemath/cysignals"
|
homepage="https://github.com/sagemath/cysignals"
|
||||||
changelog="https://github.com/sagemath/cysignals/releases"
|
changelog="https://github.com/sagemath/cysignals/releases"
|
||||||
distfiles="${PYPI_SITE}/c/cysignals/cysignals-${version}.tar.gz"
|
distfiles="${PYPI_SITE}/c/cysignals/cysignals-${version}.tar.gz"
|
||||||
checksum=0f1e321e55a07f901c86a36a1e4497f6ff9dfe700681d0130a38c36e4eb238c3
|
checksum=407db178fb18a91118ca742ede62000b2bee62b617eb49d26fcdad7e9ba2771a
|
||||||
|
|
||||||
post_patch() {
|
# cysignals must be compiled without _FORTIFY_SOURCE
|
||||||
# run autoconf because we patched configure.ac
|
CFLAGS="-U_FORTIFY_SOURCE"
|
||||||
autoconf
|
|
||||||
}
|
|
||||||
|
|
||||||
do_build() {
|
if [ "$XBPS_CHECK_PKGS" = full ]; then
|
||||||
# build as in python3-pep517 build style
|
# this would cause a build-time circular dependency
|
||||||
python3 -m build --no-isolation --wheel .
|
checkdepends+=" python3-cypari2"
|
||||||
}
|
fi
|
||||||
|
|
||||||
do_install() {
|
|
||||||
# install as in python3-pep517 build style
|
|
||||||
python3 -m installer --destdir ${DESTDIR} --no-compile-bytecode dist/*.whl
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue