| 182 | } |
| 183 | |
| 184 | pub fn store(ts: *mut ffi::PyThreadState) -> PyThreadStateUnlimited { |
| 185 | match VERSION.1 { |
| 186 | 6 => { |
| 187 | let ts = ts as *mut PyThreadStateUnlimited3_6; |
| 188 | unsafe { |
| 189 | let unlimited = PyThreadStateUnlimited { |
| 190 | frame: (*ts).frame, |
| 191 | recursion_depth: (*ts).recursion_depth, |
| 192 | exc_type: (*ts).exc_type, |
| 193 | exc_value: (*ts).exc_value, |
| 194 | exc_traceback: (*ts).exc_traceback, |
| 195 | ..Default::default() |
| 196 | }; |
| 197 | (*ts).frame = std::ptr::null_mut(); |
| 198 | (*ts).recursion_depth = 0; |
| 199 | (*ts).exc_type = std::ptr::null_mut(); |
| 200 | (*ts).exc_value = std::ptr::null_mut(); |
| 201 | (*ts).exc_traceback = std::ptr::null_mut(); |
| 202 | unlimited |
| 203 | } |
| 204 | } |
| 205 | 7 | 8 | 9 => { |
| 206 | let ts = ts as *mut PyThreadStateUnlimited3_789; |
| 207 | unsafe { |
| 208 | let unlimited = PyThreadStateUnlimited { |
| 209 | frame: (*ts).frame, |
| 210 | recursion_depth: (*ts).recursion_depth, |
| 211 | context: (*ts).context, |
| 212 | exc_state: (*ts).exc_state, |
| 213 | exc_info: (*ts).exc_info, |
| 214 | ..Default::default() |
| 215 | }; |
| 216 | (*ts).frame = std::ptr::null_mut(); |
| 217 | (*ts).recursion_depth = 0; |
| 218 | (*ts).context = std::ptr::null_mut(); |
| 219 | (*ts).exc_state = Default::default(); |
| 220 | (*ts).exc_info = std::ptr::addr_of_mut!((*ts).exc_state); |
| 221 | unlimited |
| 222 | } |
| 223 | } |
| 224 | 10 => { |
| 225 | let ts = ts as *mut PyThreadStateUnlimited3_10; |
| 226 | unsafe { |
| 227 | let unlimited = PyThreadStateUnlimited { |
| 228 | frame: (*ts).frame, |
| 229 | cframe: (*ts).cframe, |
| 230 | recursion_depth: (*ts).recursion_depth, |
| 231 | context: (*ts).context, |
| 232 | exc_state: (*ts).exc_state, |
| 233 | exc_info: (*ts).exc_info, |
| 234 | ..Default::default() |
| 235 | }; |
| 236 | (*ts).frame = std::ptr::null_mut(); |
| 237 | (*ts).recursion_depth = 0; |
| 238 | (*ts).context = std::ptr::null_mut(); |
| 239 | (*ts).exc_state = Default::default(); |
| 240 | (*ts).exc_info = std::ptr::addr_of_mut!((*ts).exc_state); |
| 241 | (*ts).cframe = std::ptr::addr_of_mut!((*ts).root_cframe); |