Skip to content

Commit

Permalink
Execute the example for intern macro to ensure it is correct.
Browse files Browse the repository at this point in the history
  • Loading branch information
adamreichold committed Apr 4, 2022
1 parent 30d414f commit 7b99af9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/once_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl<T> GILOnceCell<T> {
///
/// ```
/// use pyo3::intern;
/// # use pyo3::{pyfunction, types::PyDict, PyResult, Python};
/// # use pyo3::{pyfunction, types::PyDict, wrap_pyfunction, PyResult, Python};
///
/// #[pyfunction]
/// fn create_dict(py: Python<'_>) -> PyResult<&PyDict> {
Expand All @@ -138,6 +138,12 @@ impl<T> GILOnceCell<T> {
/// dict.set_item(intern!(py, "foo"), 42)?;
/// Ok(dict)
/// }
/// #
/// # Python::with_gil(|py| {
/// # let fun = wrap_pyfunction!(create_dict_faster, py).unwrap();
/// # let dict = fun.call0().unwrap();
/// # assert!(dict.contains("foo").unwrap());
/// # });
/// ```
#[macro_export]
macro_rules! intern {
Expand Down

0 comments on commit 7b99af9

Please sign in to comment.