2024-02-11 23:55:56 +00:00
|
|
|
use pyo3::{types::PyDict, Bound, Py, Python};
|
2020-04-20 17:44:31 +00:00
|
|
|
|
|
|
|
fn main() {
|
2024-02-11 23:55:56 +00:00
|
|
|
let dict: Py<PyDict> = Python::with_gil(|py| PyDict::new_bound(py).unbind());
|
2023-02-22 21:46:42 +00:00
|
|
|
|
|
|
|
// Should not be able to get access to Py contents outside of with_gil.
|
2024-02-11 23:55:56 +00:00
|
|
|
let dict: &Bound<'_, PyDict> = Python::with_gil(|py| dict.bind(py));
|
2020-04-20 17:44:31 +00:00
|
|
|
|
|
|
|
let _py: Python = dict.py(); // Obtain a Python<'p> without GIL.
|
|
|
|
}
|