#ifdef MS_WINDOWS
HANDLE sigint_event;
#endif
+ PyTypeObject *siginfo_type;
} signal_state_t;
// State shared by all Python interpreters
7 /* n_in_sequence */
};
-static PyTypeObject SiginfoType;
static PyObject *
fill_siginfo(siginfo_t *si)
{
- PyObject *result = PyStructSequence_New(&SiginfoType);
+ signal_state_t *state = &signal_global_state;
+
+ PyObject *result = PyStructSequence_New(state->siginfo_type);
if (!result)
return NULL;
}
#endif
#if defined(HAVE_SIGWAITINFO) || defined(HAVE_SIGTIMEDWAIT)
- if (PyModule_AddType(m, &SiginfoType) < 0) {
+ if (PyModule_AddType(m, state->siginfo_type) < 0) {
return -1;
}
#endif
Py_CLEAR(state->default_handler);
Py_CLEAR(state->ignore_handler);
+ Py_CLEAR(state->siginfo_type);
}
#endif
#if defined(HAVE_SIGWAITINFO) || defined(HAVE_SIGTIMEDWAIT)
- if (SiginfoType.tp_name == NULL) {
- if (PyStructSequence_InitType2(&SiginfoType, &struct_siginfo_desc) < 0) {
- return -1;
- }
+ state->siginfo_type = PyStructSequence_NewType(&struct_siginfo_desc);
+ if (state->siginfo_type == NULL) {
+ return -1;
}
#endif