diff --git a/src/script/src/python/ffi_types/vector/tests.rs b/src/script/src/python/ffi_types/vector/tests.rs index 52794b80cd..6d25e06307 100644 --- a/src/script/src/python/ffi_types/vector/tests.rs +++ b/src/script/src/python/ffi_types/vector/tests.rs @@ -25,12 +25,12 @@ use datatypes::vectors::{BooleanVector, Float64Vector, Int64Vector, VectorRef}; #[cfg(feature = "pyo3_backend")] use pyo3::{types::PyDict, Python}; use rustpython_compiler::Mode; -use rustpython_vm::class::PyClassImpl; -use rustpython_vm::{vm, AsObject}; +use rustpython_vm::AsObject; use crate::python::ffi_types::PyVector; #[cfg(feature = "pyo3_backend")] use crate::python::pyo3::{init_cpython_interpreter, vector_impl::into_pyo3_cell}; +use crate::python::rspython::init_interpreter; #[derive(Debug, Clone)] struct TestCase { @@ -155,10 +155,7 @@ fn eval_pyo3(testcase: TestCase, locals: HashMap) { } fn eval_rspy(testcase: TestCase, locals: HashMap) { - vm::Interpreter::with_init(Default::default(), |vm| { - let _ = PyVector::make_class(&vm.ctx); - }) - .enter(|vm| { + init_interpreter().enter(|vm| { let scope = vm.new_scope_with_builtins(); locals.into_iter().for_each(|(k, v)| { scope diff --git a/src/script/src/python/pyo3/utils.rs b/src/script/src/python/pyo3/utils.rs index facc03a6f7..04146a6a6f 100644 --- a/src/script/src/python/pyo3/utils.rs +++ b/src/script/src/python/pyo3/utils.rs @@ -45,8 +45,12 @@ pub(crate) fn init_cpython_interpreter() -> PyResult<()> { if !*start { pyo3::append_to_inittab!(greptime_builtins); pyo3::prepare_freethreaded_python(); + let version = Python::with_gil(|py| -> PyResult { + let builtins = PyModule::import(py, "sys")?; + builtins.getattr("version")?.extract() + })?; *start = true; - info!("Started CPython Interpreter"); + info!("Started CPython Interpreter {version}"); } Ok(()) } diff --git a/src/script/src/python/rspython/copr_impl.rs b/src/script/src/python/rspython/copr_impl.rs index 84ebd1c544..620f48fca1 100644 --- a/src/script/src/python/rspython/copr_impl.rs +++ b/src/script/src/python/rspython/copr_impl.rs @@ -221,7 +221,14 @@ pub(crate) fn init_interpreter() -> Rc { init_greptime_builtins("greptime", vm); init_data_frame("data_frame", vm); })); - info!("Initialized Python interpreter."); + interpreter + .enter(|vm| { + let sys = vm.sys_module.clone(); + let version = sys.get_attr("version", vm)?.str(vm)?; + info!("Initialized RustPython interpreter {version}"); + Ok::<(), PyBaseExceptionRef>(()) + }) + .expect("fail to display RustPython interpreter version"); interpreter }) .clone()