Skip to content

Commit 9398df6

Browse files
remove auto-initialize PyO3 feature and use prepare_freethreaded_python (#121)
1 parent 95a0f5f commit 9398df6

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

crates/djls-project/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7-
pyo3 = { workspace = true, features = ["auto-initialize"] }
7+
pyo3 = { workspace = true }
88
tower-lsp-server = { workspace = true, features = ["proposed"] }
99

1010
which = "7.0.1"

crates/djls-project/src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,8 @@ mod tests {
587587

588588
let test_env = create_test_env(vec![path1.clone(), path2.clone()]);
589589

590+
pyo3::prepare_freethreaded_python();
591+
590592
Python::with_gil(|py| {
591593
let initial_sys_path = get_sys_path(py)?;
592594
let initial_len = initial_sys_path.len();
@@ -618,6 +620,8 @@ mod tests {
618620
fn test_activate_empty_sys_path() -> PyResult<()> {
619621
let test_env = create_test_env(vec![]);
620622

623+
pyo3::prepare_freethreaded_python();
624+
621625
Python::with_gil(|py| {
622626
let initial_sys_path = get_sys_path(py)?;
623627

@@ -642,6 +646,8 @@ mod tests {
642646

643647
let test_env = create_test_env(vec![path1.clone(), path2.clone()]);
644648

649+
pyo3::prepare_freethreaded_python();
650+
645651
Python::with_gil(|py| {
646652
let initial_sys_path = get_sys_path(py)?;
647653
let initial_len = initial_sys_path.len();
@@ -689,6 +695,8 @@ mod tests {
689695

690696
let test_env = create_test_env(vec![valid_path.clone(), non_utf8_path.clone()]);
691697

698+
pyo3::prepare_freethreaded_python();
699+
692700
Python::with_gil(|py| {
693701
let initial_sys_path = get_sys_path(py)?;
694702
let initial_len = initial_sys_path.len();
@@ -747,6 +755,8 @@ mod tests {
747755

748756
let test_env = create_test_env(vec![valid_path.clone(), non_utf8_path.clone()]);
749757

758+
pyo3::prepare_freethreaded_python();
759+
750760
Python::with_gil(|py| {
751761
let initial_sys_path = get_sys_path(py)?;
752762
let initial_len = initial_sys_path.len();

0 commit comments

Comments
 (0)