| 247 | } |
| 248 | |
| 249 | pub fn restore(limited: *mut ffi::PyThreadState, unlimited: &PyThreadStateUnlimited) { |
| 250 | match VERSION.1 { |
| 251 | 6 => { |
| 252 | let ts = limited as *mut PyThreadStateUnlimited3_6; |
| 253 | unsafe { |
| 254 | (*ts).frame = unlimited.frame; |
| 255 | (*ts).recursion_depth = unlimited.recursion_depth; |
| 256 | (*ts).exc_type = unlimited.exc_type; |
| 257 | (*ts).exc_value = unlimited.exc_value; |
| 258 | (*ts).exc_traceback = unlimited.exc_traceback; |
| 259 | } |
| 260 | } |
| 261 | 7 | 8 | 9 => { |
| 262 | let ts = limited as *mut PyThreadStateUnlimited3_789; |
| 263 | unsafe { |
| 264 | (*ts).frame = unlimited.frame; |
| 265 | (*ts).recursion_depth = unlimited.recursion_depth; |
| 266 | (*ts).context = unlimited.context; |
| 267 | (*ts).exc_state = unlimited.exc_state; |
| 268 | (*ts).exc_info = unlimited.exc_info; |
| 269 | } |
| 270 | } |
| 271 | 10 => { |
| 272 | let ts = limited as *mut PyThreadStateUnlimited3_10; |
| 273 | unsafe { |
| 274 | (*ts).frame = unlimited.frame; |
| 275 | (*ts).cframe = unlimited.cframe; |
| 276 | (*ts).recursion_depth = unlimited.recursion_depth; |
| 277 | (*ts).context = unlimited.context; |
| 278 | (*ts).exc_state = unlimited.exc_state; |
| 279 | (*ts).exc_info = unlimited.exc_info; |
| 280 | } |
| 281 | } |
| 282 | _ => unimplemented!(), |
| 283 | } |
| 284 | } |