From b7a15322a65f0410d9b2014d1d856619176f1fc0 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 25 Feb 2024 19:57:53 -0800 Subject: [PATCH] Add 'noexcept' for Cython 3 --- PARIKernel/io.pyx | 12 ++++++------ PARIKernel/kernel.pyx | 2 +- PARIKernel/svg.pyx | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/PARIKernel/io.pyx b/PARIKernel/io.pyx index 7d9620c..dc68370 100644 --- a/PARIKernel/io.pyx +++ b/PARIKernel/io.pyx @@ -31,22 +31,22 @@ cdef extern from "Python.h": cdef PARIKernelIO io -cdef void out_putch(char c) with gil: +cdef void out_putch(char c) noexcept with gil: io.stdout_stream.write(PyUnicode_FromStringAndSize(&c, 1)) -cdef void out_puts(const char* s) with gil: +cdef void out_puts(const char* s) noexcept with gil: io.stdout_stream.write(PyUnicode_FromString(s)) -cdef void out_flush() with gil: +cdef void out_flush() noexcept with gil: io.stdout_stream.flush() -cdef void err_putch(char c) with gil: +cdef void err_putch(char c) noexcept with gil: io.stderr_stream.write(PyUnicode_FromStringAndSize(&c, 1)) -cdef void err_puts(const char* s) with gil: +cdef void err_puts(const char* s) noexcept with gil: io.stderr_stream.write(PyUnicode_FromString(s)) -cdef void err_flush() with gil: +cdef void err_flush() noexcept with gil: io.stderr_stream.flush() diff --git a/PARIKernel/kernel.pyx b/PARIKernel/kernel.pyx index d2f4e2c..9ed8e9e 100644 --- a/PARIKernel/kernel.pyx +++ b/PARIKernel/kernel.pyx @@ -38,7 +38,7 @@ DEF PRIMELIMIT = 500000 # Global setjmp() context for error handling cdef sigjmp_buf context -cdef void pari_recover(long numerr) nogil: +cdef void pari_recover(long numerr) noexcept nogil: siglongjmp(context, numerr) # Global PARI readline interface diff --git a/PARIKernel/svg.pyx b/PARIKernel/svg.pyx index 896eb20..5ef19f4 100644 --- a/PARIKernel/svg.pyx +++ b/PARIKernel/svg.pyx @@ -30,7 +30,7 @@ def init_svg(kernel): pari_set_plot_engine(get_plot) -cdef void get_plot(PARI_plot* T) nogil: +cdef void get_plot(PARI_plot* T) noexcept nogil: # Values copied from src/graph/plotsvg.c in PARI sources T.width = 480 T.height = 320 @@ -42,7 +42,7 @@ cdef void get_plot(PARI_plot* T) nogil: T.draw = draw -cdef void draw(PARI_plot *T, GEN w, GEN x, GEN y) nogil: +cdef void draw(PARI_plot *T, GEN w, GEN x, GEN y) noexcept nogil: global avma cdef pari_sp av = avma cdef char* svg = rect2svg(w, x, y, T)