Skip to content

remove auto-initialize PyO3 feature and use prepare_freethreaded_python #121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/djls-project/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 10 additions & 0 deletions crates/djls-project/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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)?;

Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
Loading