Skip to content

Commit 81903a4

Browse files
authored
Merge pull request #187 from dimpase/more_robust_docbuild
make docbuild more robust, add noexcept's
2 parents 820d36a + 0ebd0a7 commit 81903a4

File tree

6 files changed

+26
-26
lines changed

6 files changed

+26
-26
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ dist: configure
2525
chmod -R go+rX-w .
2626
umask 0022 && $(PYTHON) setup.py sdist --formats=gztar
2727

28-
doc:
28+
doc: install
2929
cd docs && $(MAKE) html
3030

3131

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# You can set these variables from the command line.
55
SPHINXOPTS =
6-
SPHINXBUILD = sphinx-build
6+
SPHINXBUILD = python3 $(shell which sphinx-build)
77
PAPER =
88
BUILDDIR = build
99

src/cysignals/memory.pxd

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,35 +33,35 @@ cdef extern from *:
3333
int unlikely(int) nogil # Defined by Cython
3434

3535

36-
cdef inline void* sig_malloc "sig_malloc"(size_t n) nogil:
36+
cdef inline void* sig_malloc "sig_malloc"(size_t n) noexcept nogil:
3737
sig_block()
3838
cdef void* ret = malloc(n)
3939
sig_unblock()
4040
return ret
4141

4242

43-
cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) nogil:
43+
cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) noexcept nogil:
4444
sig_block()
4545
cdef void* ret = realloc(ptr, size)
4646
sig_unblock()
4747
return ret
4848

4949

50-
cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) nogil:
50+
cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) noexcept nogil:
5151
sig_block()
5252
cdef void* ret = calloc(nmemb, size)
5353
sig_unblock()
5454
return ret
5555

5656

57-
cdef inline void sig_free "sig_free"(void* ptr) nogil:
57+
cdef inline void sig_free "sig_free"(void* ptr) noexcept nogil:
5858
sig_block()
5959
free(ptr)
6060
sig_unblock()
6161

6262

6363
@cython.cdivision(True)
64-
cdef inline size_t mul_overflowcheck(size_t a, size_t b) nogil:
64+
cdef inline size_t mul_overflowcheck(size_t a, size_t b) noexcept nogil:
6565
"""
6666
Return a*b, checking for overflow. Assume that a > 0.
6767
If overflow occurs, return <size_t>(-1).

src/cysignals/signals.pxd.in

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ cdef extern from "macros.h" nogil:
5050
int sig_check_no_except "sig_check"()
5151

5252
# This function adds custom block/unblock/pending.
53-
cdef int add_custom_signals(int (*custom_signal_is_blocked)(),
54-
void (*custom_signal_unblock)(),
55-
void (*custom_set_pending_signal)(int)) except -1
53+
cdef int add_custom_signals(int (*custom_signal_is_blocked)() noexcept,
54+
void (*custom_signal_unblock)() noexcept,
55+
void (*custom_set_pending_signal)(int) noexcept) except -1
5656

5757
# This function does nothing, but it is declared cdef except *, so it
5858
# can be used to make Cython check whether there is a pending exception
@@ -62,9 +62,9 @@ cdef inline void cython_check_exception() except * nogil:
6262
pass
6363

6464

65-
cdef void verify_exc_value()
65+
cdef void verify_exc_value() noexcept
6666

67-
cdef inline PyObject* sig_occurred():
67+
cdef inline PyObject* sig_occurred() noexcept:
6868
"""
6969
Borrowed reference to the exception which is currently being
7070
propagated from cysignals. If there is no exception or if we
@@ -88,13 +88,13 @@ cdef inline PyObject* sig_occurred():
8888
# these available to every Cython module cimporting this file.
8989
cdef nogil:
9090
cysigs_t cysigs "cysigs"
91-
void _sig_on_interrupt_received "_sig_on_interrupt_received"()
92-
void _sig_on_recover "_sig_on_recover"()
93-
void _sig_off_warning "_sig_off_warning"(const char*, int)
94-
void print_backtrace "print_backtrace"()
91+
void _sig_on_interrupt_received "_sig_on_interrupt_received"() noexcept
92+
void _sig_on_recover "_sig_on_recover"() noexcept
93+
void _sig_off_warning "_sig_off_warning"(const char*, int) noexcept
94+
void print_backtrace "print_backtrace"() noexcept
9595

9696

97-
cdef inline void __generate_declarations():
97+
cdef inline void __generate_declarations() noexcept:
9898
cysigs
9999
_sig_on_interrupt_received
100100
_sig_on_recover

src/cysignals/signals.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ def _pari_version():
8080
return v.decode('ascii')
8181

8282

83-
cdef int add_custom_signals(int (*custom_signal_is_blocked)(),
84-
void (*custom_signal_unblock)(),
85-
void (*custom_set_pending_signal)(int)) except -1:
83+
cdef int add_custom_signals(int (*custom_signal_is_blocked)() noexcept,
84+
void (*custom_signal_unblock)() noexcept,
85+
void (*custom_set_pending_signal)(int) noexcept) except -1:
8686
"""
8787
Add an external block/unblock/pending to cysignals.
8888
@@ -341,7 +341,7 @@ def python_check_interrupt(sig, frame):
341341
sig_check()
342342

343343

344-
cdef void verify_exc_value():
344+
cdef void verify_exc_value() noexcept:
345345
"""
346346
Check that ``cysigs.exc_value`` is still the exception being raised.
347347
Clear ``cysigs.exc_value`` if not.

src/cysignals/tests.pyx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ set_debug_level(0)
8989
########################################################################
9090
# C helper functions #
9191
########################################################################
92-
cdef void infinite_loop() nogil:
92+
cdef void infinite_loop() noexcept nogil:
9393
# Ensure that the compiler cannot "optimize away" this infinite
9494
# loop, see https://bugs.llvm.org/show_bug.cgi?id=965
9595
cdef volatile_int x = 0
9696
while x == 0:
9797
pass
9898

99-
cdef void infinite_malloc_loop() nogil:
99+
cdef void infinite_malloc_loop() noexcept nogil:
100100
cdef size_t s = 1
101101
while True:
102102
sig_free(sig_malloc(s))
@@ -106,12 +106,12 @@ cdef void infinite_malloc_loop() nogil:
106106
# Dereference a NULL pointer on purpose. This signals a SIGSEGV on most
107107
# systems, but on older Mac OS X and possibly other systems, this
108108
# signals a SIGBUS instead. In any case, this should give some signal.
109-
cdef void dereference_null_pointer() nogil:
109+
cdef void dereference_null_pointer() noexcept nogil:
110110
cdef volatile_int* ptr = <volatile_int*>(0)
111111
ptr[0] += 1
112112

113113

114-
cdef int stack_overflow(volatile_int* x=NULL) nogil:
114+
cdef int stack_overflow(volatile_int* x=NULL) noexcept nogil:
115115
cdef volatile_int a = 0
116116
if x is not NULL:
117117
a = x[0]
@@ -258,7 +258,7 @@ def test_sig_str(long delay=DEFAULT_DELAY):
258258
signal_after_delay(SIGABRT, delay)
259259
infinite_loop()
260260

261-
cdef c_test_sig_on_cython():
261+
cdef c_test_sig_on_cython() noexcept:
262262
sig_on()
263263
infinite_loop()
264264

0 commit comments

Comments
 (0)