Skip to content

Commit

Permalink
Merge pull request #36 from mkoeppe/cython3
Browse files Browse the repository at this point in the history
Add 'noexcept' for Cython 3
  • Loading branch information
videlec authored Feb 26, 2024
2 parents af363f0 + b7a1532 commit 04d0b13
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions PARIKernel/io.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down
2 changes: 1 addition & 1 deletion PARIKernel/kernel.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions PARIKernel/svg.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 04d0b13

Please sign in to comment.