Skip to content

Commit

Permalink
fix doctest on abi3
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Mar 18, 2024
1 parent 8d9a39d commit 45b541d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions guide/src/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ assert_eq!(name, "list");
After:

```rust
# #[cfg(any(not(Py_LIMITED_API), Py_3_10))] {
# use pyo3::prelude::*;
# use pyo3::types::{PyList, PyType};
# fn example<'py>(py: Python<'py>) -> PyResult<()> {
Expand All @@ -361,6 +362,7 @@ assert_eq!(name, "list");
# Ok(())
# }
# Python::with_gil(example).unwrap();
# }
```

An alternative is to use the new `PyBackedStr` type, which stores a reference to the Python `str` without a lifetime attachment:
Expand Down

0 comments on commit 45b541d

Please sign in to comment.