Get a handle to the main interpreter that can be used with subinterpreter_scoped_activate Note that destructing the handle is a noop, the main interpreter can only be ended by py::finalize_interpreter()
| 190 | /// Note that destructing the handle is a noop, the main interpreter can only be ended by |
| 191 | /// py::finalize_interpreter() |
| 192 | static subinterpreter main() { |
| 193 | subinterpreter m; |
| 194 | m.istate_ = PyInterpreterState_Main(); |
| 195 | m.disarm(); // make destruct a noop |
| 196 | return m; |
| 197 | } |
| 198 | |
| 199 | /// Get a non-owning wrapper of the currently active interpreter (if any) |
| 200 | static subinterpreter current() { |