-
Notifications
You must be signed in to change notification settings - Fork 783
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test which is broken with gevent
- Loading branch information
1 parent
1dca879
commit 7b82bbd
Showing
4 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
use pyo3::prelude::*; | ||
use pyo3::{prelude::*, types::PyDict}; | ||
|
||
#[pyfunction] | ||
fn issue_219() { | ||
// issue 219: acquiring GIL inside #[pyfunction] deadlocks. | ||
Python::with_gil(|_| {}); | ||
} | ||
|
||
#[pyfunction] | ||
fn get_item_and_run_callback(dict: &PyDict, callback: &PyAny) -> PyResult<()> { | ||
let item = dict.get_item("key")?.expect("key not found in dict"); | ||
let string = item.to_string(); | ||
callback.call0()?; | ||
assert_eq!(item.to_string(), string); | ||
Ok(()) | ||
} | ||
|
||
#[pymodule] | ||
pub fn misc(_py: Python<'_>, m: &PyModule) -> PyResult<()> { | ||
m.add_function(wrap_pyfunction!(issue_219, m)?)?; | ||
m.add_function(wrap_pyfunction!(get_item_and_run_callback, m)?)?; | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters