rustapi_module: move issue_219 regression test

This commit is contained in:
David Hewitt 2020-11-10 14:21:48 +00:00
parent 9a703018a8
commit 126a74842f
6 changed files with 25 additions and 13 deletions

View File

@ -41,11 +41,12 @@ setup(
rust_extensions=[
make_rust_extension("rustapi_module.buf_and_str"),
make_rust_extension("rustapi_module.datetime"),
make_rust_extension("rustapi_module.misc"),
make_rust_extension("rustapi_module.objstore"),
make_rust_extension("rustapi_module.othermod"),
make_rust_extension("rustapi_module.pyclass_iter"),
make_rust_extension("rustapi_module.subclassing"),
make_rust_extension("rustapi_module.test_dict"),
make_rust_extension("rustapi_module.pyclass_iter"),
],
include_package_data=True,
zip_safe=False,

View File

@ -183,13 +183,6 @@ fn datetime_from_timestamp<'p>(
PyDateTime::from_timestamp(py, ts, tz)
}
#[pyfunction]
fn issue_219() -> PyResult<()> {
let gil = Python::acquire_gil();
let _py = gil.python();
Ok(())
}
#[pyclass(extends=PyTzInfo)]
pub struct TzClass {}
@ -234,7 +227,6 @@ fn datetime(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
m.add_function(wrap_pyfunction!(get_datetime_tuple_fold, m)?)?;
}
m.add_function(wrap_pyfunction!(issue_219, m)?)?;
m.add_class::<TzClass>()?;
Ok(())

View File

@ -1,6 +1,7 @@
pub mod buf_and_str;
pub mod datetime;
pub mod dict_iter;
pub mod misc;
pub mod objstore;
pub mod othermod;
pub mod pyclass_iter;

View File

@ -0,0 +1,16 @@
use pyo3::prelude::*;
use pyo3::wrap_pyfunction;
#[pyfunction]
fn issue_219() -> PyResult<()> {
// issue 219: acquiring GIL inside #[pyfunction] deadlocks.
let gil = Python::acquire_gil();
let _py = gil.python();
Ok(())
}
#[pymodule]
fn misc(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
m.add_function(wrap_pyfunction!(issue_219, m)?)?;
Ok(())
}

View File

@ -293,10 +293,6 @@ def test_delta_err(args, err_type):
rdt.make_delta(*args)
def test_issue_219():
rdt.issue_219()
def test_tz_class():
tzi = rdt.TzClass()

View File

@ -0,0 +1,6 @@
import rustapi_module.misc
def test_issue_219():
# Should not deadlock
rustapi_module.misc.issue_219()