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 = ...)] on dunder (__magic__) methods #4117

Merged
merged 2 commits into from
May 4, 2024

Conversation

Icxolu
Copy link
Contributor

@Icxolu Icxolu commented Apr 24, 2024

Handle #[pyo3(from_py_with = ...)] attribute on dunder (__magic__) method arguments

Closes #4113

.collect()
}
}

enum GilRefCheckerType {
FunctionArg,
Copy link
Member

Choose a reason for hiding this comment

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

I understand it is not required to model the state space (yet), but maybe the code would become clearer if the syn::Ident is passed into the variants, e.g.

enum GilRefChecker {
  FunctionArg(syn::Ident),
  FromPyWith(syn::Ident),
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I thought about it as well, when I wrote it, but wasn't sure which one is the better option. I'll update 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 great, thanks both!

@davidhewitt davidhewitt added this pull request to the merge queue May 4, 2024
Merged via the queue into PyO3:main with commit e835ff0 May 4, 2024
43 checks passed
@Icxolu Icxolu deleted the issue/4113 branch May 4, 2024 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

#[pyo3(from_py_with)] is ignored in dunder methods (__eq__, etc.)
3 participants