remove auto-initialize PyO3 feature and use prepare_freethreaded_python (#121)

This commit is contained in:
Josh Thomas 2025-04-30 14:20:40 -05:00 committed by GitHub
parent 95a0f5f452
commit 9398df6a21
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View file

@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"
[dependencies]
pyo3 = { workspace = true, features = ["auto-initialize"] }
pyo3 = { workspace = true }
tower-lsp-server = { workspace = true, features = ["proposed"] }
which = "7.0.1"

View file

@ -587,6 +587,8 @@ mod tests {
let test_env = create_test_env(vec![path1.clone(), path2.clone()]);
pyo3::prepare_freethreaded_python();
Python::with_gil(|py| {
let initial_sys_path = get_sys_path(py)?;
let initial_len = initial_sys_path.len();
@ -618,6 +620,8 @@ mod tests {
fn test_activate_empty_sys_path() -> PyResult<()> {
let test_env = create_test_env(vec![]);
pyo3::prepare_freethreaded_python();
Python::with_gil(|py| {
let initial_sys_path = get_sys_path(py)?;
@ -642,6 +646,8 @@ mod tests {
let test_env = create_test_env(vec![path1.clone(), path2.clone()]);
pyo3::prepare_freethreaded_python();
Python::with_gil(|py| {
let initial_sys_path = get_sys_path(py)?;
let initial_len = initial_sys_path.len();
@ -689,6 +695,8 @@ mod tests {
let test_env = create_test_env(vec![valid_path.clone(), non_utf8_path.clone()]);
pyo3::prepare_freethreaded_python();
Python::with_gil(|py| {
let initial_sys_path = get_sys_path(py)?;
let initial_len = initial_sys_path.len();
@ -747,6 +755,8 @@ mod tests {
let test_env = create_test_env(vec![valid_path.clone(), non_utf8_path.clone()]);
pyo3::prepare_freethreaded_python();
Python::with_gil(|py| {
let initial_sys_path = get_sys_path(py)?;
let initial_len = initial_sys_path.len();