Lines 1-4
Link Here
|
1 |
--- src/sage/libs/ecl.pyx.orig 2020-05-22 13:21:27 UTC |
1 |
--- src/sage/libs/ecl.pyx.orig 2020-06-18 17:03:16 UTC |
2 |
+++ src/sage/libs/ecl.pyx |
2 |
+++ src/sage/libs/ecl.pyx |
3 |
@@ -15,7 +15,7 @@ Library interface to Embeddable Common Lisp (ECL) |
3 |
@@ -15,7 +15,7 @@ Library interface to Embeddable Common Lisp (ECL) |
4 |
#adapted to work with pure Python types. |
4 |
#adapted to work with pure Python types. |
Lines 5-11
Link Here
|
5 |
|
5 |
|
6 |
from libc.stdlib cimport abort |
6 |
from libc.stdlib cimport abort |
7 |
-from libc.signal cimport SIGINT, SIGBUS, SIGSEGV, SIGCHLD |
7 |
-from libc.signal cimport SIGINT, SIGBUS, SIGSEGV, SIGCHLD |
8 |
+from libc.signal cimport SIGINT, SIGBUS, SIGSEGV, SIGCHLD, SIGFPE |
8 |
+from libc.signal cimport SIGINT, SIGBUS, SIGSEGV, SIGFPE |
9 |
from libc.signal cimport raise_ as signal_raise |
9 |
from libc.signal cimport raise_ as signal_raise |
10 |
from posix.signal cimport sigaction, sigaction_t |
10 |
from posix.signal cimport sigaction, sigaction_t |
11 |
cimport cysignals.signals |
11 |
cimport cysignals.signals |
Lines 24-30
Link Here
|
24 |
|
24 |
|
25 |
cdef cl_object string_to_object(char * s): |
25 |
cdef cl_object string_to_object(char * s): |
26 |
return ecl_read_from_cstring(s) |
26 |
return ecl_read_from_cstring(s) |
27 |
@@ -238,6 +243,7 @@ def init_ecl(): |
27 |
@@ -139,7 +144,6 @@ def test_ecl_options(): |
|
|
28 |
ECL_OPT_TRAP_SIGINT = 1 |
29 |
ECL_OPT_TRAP_SIGILL = 1 |
30 |
ECL_OPT_TRAP_SIGBUS = 1 |
31 |
- ECL_OPT_TRAP_SIGCHLD = 0 |
32 |
ECL_OPT_TRAP_SIGPIPE = 1 |
33 |
ECL_OPT_TRAP_INTERRUPT_SIGNAL = 1 |
34 |
ECL_OPT_SIGNAL_HANDLING_THREAD = 0 |
35 |
@@ -153,7 +157,6 @@ def test_ecl_options(): |
36 |
ECL_OPT_LISP_STACK_SAFETY_AREA = ... |
37 |
ECL_OPT_C_STACK_SIZE = ... |
38 |
ECL_OPT_C_STACK_SAFETY_AREA = ... |
39 |
- ECL_OPT_SIGALTSTACK_SIZE = 1 |
40 |
ECL_OPT_HEAP_SIZE = ... |
41 |
ECL_OPT_HEAP_SAFETY_AREA = ... |
42 |
ECL_OPT_THREAD_INTERRUPT_SIGNAL = ... |
43 |
@@ -171,8 +174,6 @@ def test_ecl_options(): |
44 |
ecl_get_option(ECL_OPT_TRAP_SIGILL))) |
45 |
print('ECL_OPT_TRAP_SIGBUS = {0}'.format( |
46 |
ecl_get_option(ECL_OPT_TRAP_SIGBUS))) |
47 |
- print('ECL_OPT_TRAP_SIGCHLD = {0}'.format( |
48 |
- ecl_get_option(ECL_OPT_TRAP_SIGCHLD))) |
49 |
print('ECL_OPT_TRAP_SIGPIPE = {0}'.format( |
50 |
ecl_get_option(ECL_OPT_TRAP_SIGPIPE))) |
51 |
print('ECL_OPT_TRAP_INTERRUPT_SIGNAL = {0}'.format( |
52 |
@@ -199,8 +200,6 @@ def test_ecl_options(): |
53 |
ecl_get_option(ECL_OPT_C_STACK_SIZE))) |
54 |
print('ECL_OPT_C_STACK_SAFETY_AREA = {0}'.format( |
55 |
ecl_get_option(ECL_OPT_C_STACK_SAFETY_AREA))) |
56 |
- print('ECL_OPT_SIGALTSTACK_SIZE = {0}'.format( |
57 |
- ecl_get_option(ECL_OPT_SIGALTSTACK_SIZE))) |
58 |
print('ECL_OPT_HEAP_SIZE = {0}'.format( |
59 |
ecl_get_option(ECL_OPT_HEAP_SIZE))) |
60 |
print('ECL_OPT_HEAP_SAFETY_AREA = {0}'.format( |
61 |
@@ -238,14 +237,12 @@ def init_ecl(): |
28 |
global ecl_has_booted |
62 |
global ecl_has_booted |
29 |
cdef char *argv[1] |
63 |
cdef char *argv[1] |
30 |
cdef sigaction_t sage_action[32] |
64 |
cdef sigaction_t sage_action[32] |
Lines 32-38
Link Here
|
32 |
cdef int i |
66 |
cdef int i |
33 |
|
67 |
|
34 |
if ecl_has_booted: |
68 |
if ecl_has_booted: |
35 |
@@ -257,6 +263,8 @@ def init_ecl(): |
69 |
raise RuntimeError("ECL is already initialized") |
|
|
70 |
|
71 |
- # we need it to stop handling SIGCHLD |
72 |
- ecl_set_option(ECL_OPT_TRAP_SIGCHLD, 0); |
73 |
- |
74 |
#we keep our own GMP memory functions. ECL should not claim them |
75 |
ecl_set_option(ECL_OPT_SET_GMP_MEMORY_FUNCTIONS,0); |
76 |
|
77 |
@@ -257,6 +254,8 @@ def init_ecl(): |
36 |
for i in range(1,32): |
78 |
for i in range(1,32): |
37 |
sigaction(i, NULL, &sage_action[i]) |
79 |
sigaction(i, NULL, &sage_action[i]) |
38 |
|
80 |
|
Lines 41-47
Link Here
|
41 |
#initialize ECL |
83 |
#initialize ECL |
42 |
ecl_set_option(ECL_OPT_SIGNAL_HANDLING_THREAD, 0) |
84 |
ecl_set_option(ECL_OPT_SIGNAL_HANDLING_THREAD, 0) |
43 |
cl_boot(1, argv) |
85 |
cl_boot(1, argv) |
44 |
@@ -264,8 +272,12 @@ def init_ecl(): |
86 |
@@ -264,18 +263,19 @@ def init_ecl(): |
45 |
#save signal handler from ECL |
87 |
#save signal handler from ECL |
46 |
sigaction(SIGINT, NULL, &ecl_sigint_handler) |
88 |
sigaction(SIGINT, NULL, &ecl_sigint_handler) |
47 |
sigaction(SIGBUS, NULL, &ecl_sigbus_handler) |
89 |
sigaction(SIGBUS, NULL, &ecl_sigbus_handler) |
Lines 48-60
Link Here
|
48 |
+ sigaction(SIGFPE, NULL, &ecl_sigfpe_handler) |
90 |
+ sigaction(SIGFPE, NULL, &ecl_sigfpe_handler) |
49 |
sigaction(SIGSEGV, NULL, &ecl_sigsegv_handler) |
91 |
sigaction(SIGSEGV, NULL, &ecl_sigsegv_handler) |
50 |
|
92 |
|
|
|
93 |
- #verify that no SIGCHLD handler was installed |
94 |
- cdef sigaction_t sig_test |
95 |
- sigaction(SIGCHLD, NULL, &sig_test) |
96 |
- assert sage_action[SIGCHLD].sa_handler == NULL # Sage does not set SIGCHLD handler |
97 |
- assert sig_test.sa_handler == NULL # And ECL bootup did not set one |
51 |
+ #save ECL's floating point exception flags |
98 |
+ #save ECL's floating point exception flags |
52 |
+ ecl_feflags = fegetexcept() |
99 |
+ ecl_feflags = fegetexcept() |
53 |
+ |
100 |
|
54 |
#verify that no SIGCHLD handler was installed |
101 |
#and put the Sage signal handlers back |
55 |
cdef sigaction_t sig_test |
|
|
56 |
sigaction(SIGCHLD, NULL, &sig_test) |
57 |
@@ -276,6 +288,9 @@ def init_ecl(): |
58 |
for i in range(1,32): |
102 |
for i in range(1,32): |
59 |
sigaction(i, &sage_action[i], NULL) |
103 |
sigaction(i, &sage_action[i], NULL) |
60 |
|
104 |
|
Lines 64-70
Link Here
|
64 |
#initialise list of objects and bind to global variable |
108 |
#initialise list of objects and bind to global variable |
65 |
# *SAGE-LIST-OF-OBJECTS* to make it rooted in the reachable tree for the GC |
109 |
# *SAGE-LIST-OF-OBJECTS* to make it rooted in the reachable tree for the GC |
66 |
list_of_objects=cl_cons(Cnil,cl_cons(Cnil,Cnil)) |
110 |
list_of_objects=cl_cons(Cnil,cl_cons(Cnil,Cnil)) |
67 |
@@ -319,7 +334,6 @@ def init_ecl(): |
111 |
@@ -319,7 +319,6 @@ def init_ecl(): |
68 |
(values nil (princ-to-string cnd))))) |
112 |
(values nil (princ-to-string cnd))))) |
69 |
""")) |
113 |
""")) |
70 |
safe_funcall_clobj=cl_eval(string_to_object(b"(symbol-function 'sage-safe-funcall)")) |
114 |
safe_funcall_clobj=cl_eval(string_to_object(b"(symbol-function 'sage-safe-funcall)")) |