@@ -334,7 +334,7 @@ def prec_dec_to_bits(long prec_in_dec):
334334 return int (prec_in_dec* log_10 + 1.0 ) # Add one to round up
335335
336336
337- cpdef long prec_bits_to_words(unsigned long prec_in_bits):
337+ cpdef long prec_bits_to_words(unsigned long prec_in_bits) noexcept :
338338 r """
339339 Convert from precision expressed in bits to pari real precision
340340 expressed in words. Note: this rounds up to the nearest word,
@@ -362,7 +362,7 @@ cpdef long prec_bits_to_words(unsigned long prec_in_bits):
362362 return (prec_in_bits - 1 )// wordsize + 3
363363
364364
365- cpdef long prec_words_to_bits(long prec_in_words):
365+ cpdef long prec_words_to_bits(long prec_in_words) noexcept :
366366 r """
367367 Convert from pari real precision expressed in words to precision
368368 expressed in bits. Note: this adjusts for the two codewords of a
@@ -385,7 +385,7 @@ cpdef long prec_words_to_bits(long prec_in_words):
385385 return (prec_in_words - 2 ) * BITS_IN_LONG
386386
387387
388- cpdef long default_bitprec():
388+ cpdef long default_bitprec() noexcept :
389389 r """
390390 Return the default precision in bits.
391391
@@ -446,7 +446,7 @@ def prec_words_to_dec(long prec_in_words):
446446# of C library functions like puts().
447447cdef PariOUT python_pariOut
448448
449- cdef void python_putchar(char c):
449+ cdef void python_putchar(char c) noexcept :
450450 cdef char s[2 ]
451451 s[0 ] = c
452452 s[1 ] = 0
@@ -459,15 +459,15 @@ cdef void python_putchar(char c):
459459 # so it doesn't print one when an error occurs.
460460 pari_set_last_newline(1 )
461461
462- cdef void python_puts(const char * s):
462+ cdef void python_puts(const char * s) noexcept :
463463 try :
464464 # avoid string conversion if possible
465465 sys.stdout.buffer.write(s)
466466 except AttributeError :
467467 sys.stdout.write(to_string(s))
468468 pari_set_last_newline(1 )
469469
470- cdef void python_flush():
470+ cdef void python_flush() noexcept :
471471 sys.stdout.flush()
472472
473473include ' auto_instance.pxi'
@@ -1436,22 +1436,22 @@ cdef long get_var(v) except -2:
14361436# Monkey-patched versions of default(parisize) and default(parisizemax)
14371437# which call before_resize() and after_resize().
14381438# The monkey-patching is set up in PariInstance.__cinit__
1439- cdef GEN patched_parisize(const char * v, long flag):
1440- # Cast to int(*)() to avoid exception handling
1441- if (< int (* )()> before_resize)():
1439+ cdef GEN patched_parisize(const char * v, long flag) noexcept :
1440+ # Cast to ` int(*)() noexcept` to avoid exception handling
1441+ if (< int (* )() noexcept > before_resize)():
14421442 sig_error()
14431443 return sd_parisize(v, flag)
14441444
14451445
1446- cdef GEN patched_parisizemax(const char * v, long flag):
1447- # Cast to int(*)() to avoid exception handling
1448- if (< int (* )()> before_resize)():
1446+ cdef GEN patched_parisizemax(const char * v, long flag) noexcept :
1447+ # Cast to ` int(*)() noexcept` to avoid exception handling
1448+ if (< int (* )() noexcept > before_resize)():
14491449 sig_error()
14501450 return sd_parisizemax(v, flag)
14511451
14521452
14531453IF HAVE_PLOT_SVG:
1454- cdef void get_plot_ipython(PARI_plot* T):
1454+ cdef void get_plot_ipython(PARI_plot* T) noexcept :
14551455 # Values copied from src/graph/plotsvg.c in PARI sources
14561456 T.width = 480
14571457 T.height = 320
@@ -1462,7 +1462,7 @@ IF HAVE_PLOT_SVG:
14621462
14631463 T.draw = draw_ipython
14641464
1465- cdef void draw_ipython(PARI_plot * T, GEN w, GEN x, GEN y):
1465+ cdef void draw_ipython(PARI_plot * T, GEN w, GEN x, GEN y) noexcept :
14661466 global avma
14671467 cdef pari_sp av = avma
14681468 cdef char * svg = rect2svg(w, x, y, T)
0 commit comments