Improve derive(FromPyObject) to apply intern! when applicable
This commit is contained in:
parent
556b3cf48a
commit
8026f3521e
|
@ -0,0 +1 @@
|
|||
Improve `derive(FromPyObject)` to apply `intern!` when applicable to `#[pyo3(item)]`.
|
|
@ -315,8 +315,13 @@ impl<'a> Container<'a> {
|
|||
FieldGetter::GetAttr(None) => {
|
||||
quote!(getattr(_pyo3::intern!(obj.py(), #field_name)))
|
||||
}
|
||||
FieldGetter::GetItem(Some(syn::Lit::Str(key))) => {
|
||||
quote!(get_item(_pyo3::intern!(obj.py(), #key)))
|
||||
}
|
||||
FieldGetter::GetItem(Some(key)) => quote!(get_item(#key)),
|
||||
FieldGetter::GetItem(None) => quote!(get_item(#field_name)),
|
||||
FieldGetter::GetItem(None) => {
|
||||
quote!(get_item(_pyo3::intern!(obj.py(), #field_name)))
|
||||
}
|
||||
};
|
||||
let extractor = match &field.from_py_with {
|
||||
None => {
|
||||
|
|
Loading…
Reference in New Issue