Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle #[pyo3(from_py_with = "")] in #[setter] methods #3995

Merged
merged 2 commits into from
Mar 26, 2024

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
42 of 43 checks passed
@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