dcab478d66
* Fix lifetime safety bug of AsPyRef::as_ref(). Fixes #875. * Add test for AsPyRef's lifetimes.
11 lines
311 B
Rust
11 lines
311 B
Rust
use pyo3::{types::PyDict, AsPyRef, Py, PyNativeType, Python};
|
|
|
|
fn main() {
|
|
let gil = Python::acquire_gil();
|
|
let dict: Py<PyDict> = PyDict::new(gil.python()).into();
|
|
let dict: &PyDict = dict.as_ref(gil.python());
|
|
drop(gil);
|
|
|
|
let _py: Python = dict.py(); // Obtain a Python<'p> without GIL.
|
|
}
|