Skip to content

Commit 1dbd0c0

Browse files
committed
fix: use String instead of &str in FromPyObject for abi3 compatibility
`&str: FromPyObject` is gated by `#[cfg(any(Py_3_10, not(Py_LIMITED_API)))]`, making it unavailable under abi3-py39. Use `String` which is always available.
1 parent 18dcacb commit 1dbd0c0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

pyo3-macros-backend/src/native_enum.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,10 +334,10 @@ fn impl_native_enum(
334334
obj,
335335
#pyo3::intern!(obj.py(), "name"),
336336
)?;
337-
let name = #pyo3::types::PyAnyMethods::extract::<&str>(
337+
let name = #pyo3::types::PyAnyMethods::extract::<::std::string::String>(
338338
&name_obj
339339
)?;
340-
match name {
340+
match name.as_str() {
341341
#(#from_arms)*
342342
other => ::std::result::Result::Err(
343343
#pyo3::exceptions::PyValueError::new_err(

0 commit comments

Comments
 (0)