| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1781d55 commit d013b24
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -136,6 +136,7 @@ typedef struct { | |||
| 136 | 136 | #ifdef MS_WINDOWS | |
| 137 | 137 | HANDLE sigint_event; | |
| 138 | 138 | #endif | |
| 139 | + PyTypeObject *siginfo_type; | ||
| 139 | 140 | } signal_state_t; | |
| 140 | 141 | ||
| 141 | 142 | // State shared by all Python interpreters | |
@@ -1136,12 +1137,13 @@ static PyStructSequence_Desc struct_siginfo_desc = { | |||
| 1136 | 1137 | 7 /* n_in_sequence */ | |
| 1137 | 1138 | }; | |
| 1138 | 1139 | ||
| 1139 | - static PyTypeObject SiginfoType; | ||
| 1140 | 1140 | ||
| 1141 | 1141 | static PyObject * | |
| 1142 | 1142 | fill_siginfo(siginfo_t *si) | |
| 1143 | 1143 | { | |
| 1144 | - PyObject *result = PyStructSequence_New(&SiginfoType); | ||
| 1144 | + signal_state_t *state = &signal_global_state; | ||
| 1145 | + | ||
| 1146 | + PyObject *result = PyStructSequence_New(state->siginfo_type); | ||
| 1145 | 1147 | if (!result) | |
| 1146 | 1148 | return NULL; | |
| 1147 | 1149 | ||
@@ -1660,7 +1662,7 @@ signal_module_exec(PyObject *m) | |||
| 1660 | 1662 | } | |
| 1661 | 1663 | #endif | |
| 1662 | 1664 | #if defined(HAVE_SIGWAITINFO) || defined(HAVE_SIGTIMEDWAIT) | |
| 1663 | - if (PyModule_AddType(m, &SiginfoType) < 0) { | ||
| 1665 | + if (PyModule_AddType(m, state->siginfo_type) < 0) { | ||
| 1664 | 1666 | return -1; | |
| 1665 | 1667 | } | |
| 1666 | 1668 | #endif | |
@@ -1758,6 +1760,7 @@ _PySignal_Fini(void) | |||
| 1758 | 1760 | ||
| 1759 | 1761 | Py_CLEAR(state->default_handler); | |
| 1760 | 1762 | Py_CLEAR(state->ignore_handler); | |
| 1763 | + Py_CLEAR(state->siginfo_type); | ||
| 1761 | 1764 | } | |
| 1762 | 1765 | ||
| 1763 | 1766 | ||
@@ -1966,10 +1969,9 @@ _PySignal_Init(int install_signal_handlers) | |||
| 1966 | 1969 | #endif | |
| 1967 | 1970 | ||
| 1968 | 1971 | #if defined(HAVE_SIGWAITINFO) || defined(HAVE_SIGTIMEDWAIT) | |
| 1969 | - if (SiginfoType.tp_name == NULL) { | ||
| 1970 | - if (PyStructSequence_InitType2(&SiginfoType, &struct_siginfo_desc) < 0) { | ||
| 1971 | - return -1; | ||
| 1972 | - } | ||
| 1972 | + state->siginfo_type = PyStructSequence_NewType(&struct_siginfo_desc); | ||
| 1973 | + if (state->siginfo_type == NULL) { | ||
| 1974 | + return -1; | ||
| 1973 | 1975 | } | |
| 1974 | 1976 | #endif | |
| 1975 | 1977 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments