Skip to content

Conversation

@Icxolu
Copy link
Contributor

@Icxolu Icxolu commented Mar 26, 2024

Fixes #3992

Handle the #[pyo3(from_py_with = "")] attribute in #[setter] methods instead of silently ignoring it.

Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks!

I wonder if the fact that this slipped through means that there's a bigger refactoring overdue, but I'm happy to leave that for a future PR...

})
.unwrap_or_else(|| {
quote! {
let _val = #pyo3_path::FromPyObject::extract_bound(_value.into())?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose here we probably want to check if _val is a GIL Ref, via holders.push_gil_refs_checker?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Either way, I think worthy of its own PR and newsfragment, so I'll merge this PR now.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, maybe I'll take a look at that tomorrow

@davidhewitt davidhewitt added this pull request to the merge queue Mar 26, 2024
Merged via the queue into PyO3:main with commit 35faeff Mar 26, 2024
@MarquessV
Copy link

Thanks for the quick fix @Icxolu!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

#[pyo3(from_py_with = "...")] causes compilation error when used in methods with the #[setter] attribute.

3 participants