python-plugin: RAII (PyOwned/PyBorrowed) + autodecode enum; crate: ny-llvmc --emit exe with NyRT link; tools: build_llvm.sh crate-exe path + crate_exe_smoke; CURRENT_TASK update

This commit is contained in:
Selfhosting Dev
2025-09-18 03:57:25 +09:00
parent 1b12b1eb7d
commit 5d51086530
27 changed files with 2802 additions and 2484 deletions

View File

@ -0,0 +1,19 @@
use crate::ffi::{CPython, PyGILState_STATE};
pub struct GILGuard<'a> {
cpy: &'a CPython,
state: PyGILState_STATE,
}
impl<'a> GILGuard<'a> {
pub fn acquire(cpy: &'a CPython) -> Self {
let state = unsafe { (cpy.PyGILState_Ensure)() };
GILGuard { cpy, state }
}
}
impl<'a> Drop for GILGuard<'a> {
fn drop(&mut self) {
unsafe { (self.cpy.PyGILState_Release)(self.state) };
}
}