File tree Expand file tree Collapse file tree 3 files changed +11
-10
lines changed Expand file tree Collapse file tree 3 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,13 @@ struct _signals_runtime_state {
63
63
/* Speed up sigcheck() when none tripped */
64
64
_Py_atomic_int is_tripped ;
65
65
66
+ /* These objects necessarily belong to the main interpreter. */
67
+ PyObject * default_handler ;
68
+ PyObject * ignore_handler ;
69
+ #ifdef MS_WINDOWS
70
+ HANDLE sigint_event ;
71
+ #endif
72
+
66
73
/* True if the main interpreter thread exited due to an unhandled
67
74
* KeyboardInterrupt exception, suggesting the user pressed ^C. */
68
75
int unhandled_keyboard_interrupt ;
Original file line number Diff line number Diff line change @@ -104,16 +104,9 @@ class sigset_t_converter(CConverter):
104
104
#define wakeup _PyRuntime.signals.wakeup
105
105
#define is_tripped _PyRuntime.signals.is_tripped
106
106
107
- typedef struct {
108
- PyObject * default_handler ;
109
- PyObject * ignore_handler ;
110
- #ifdef MS_WINDOWS
111
- HANDLE sigint_event ;
112
- #endif
113
- } signal_state_t ;
114
-
115
107
// State shared by all Python interpreters
116
- static signal_state_t signal_global_state = {0 };
108
+ typedef struct _signals_runtime_state signal_state_t ;
109
+ #define signal_global_state _PyRuntime.signals
117
110
118
111
#if defined(HAVE_GETITIMER ) || defined(HAVE_SETITIMER )
119
112
# define PYHAVE_ITIMER_ERROR
@@ -1627,6 +1620,8 @@ signal_module_exec(PyObject *m)
1627
1620
signal_state_t * state = & signal_global_state ;
1628
1621
_signal_module_state * modstate = get_signal_state (m );
1629
1622
1623
+ // XXX For proper isolation, these values must be guaranteed
1624
+ // to be effectively const (e.g. immortal).
1630
1625
modstate -> default_handler = state -> default_handler ; // borrowed ref
1631
1626
modstate -> ignore_handler = state -> ignore_handler ; // borrowed ref
1632
1627
Original file line number Diff line number Diff line change @@ -408,7 +408,6 @@ Modules/_tracemalloc.c - tracemalloc_traces -
408
408
Modules/_tracemalloc.c - tracemalloc_domains -
409
409
Modules/_tracemalloc.c - tracemalloc_reentrant_key -
410
410
Modules/faulthandler.c faulthandler_dump_traceback reentrant -
411
- Modules/signalmodule.c - signal_global_state -
412
411
413
412
414
413
# #################################
You can’t perform that action at this time.
0 commit comments