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

Implement ml_meth as an union. #2166

Merged
merged 3 commits into from
Feb 15, 2022
Merged

Implement ml_meth as an union. #2166

merged 3 commits into from
Feb 15, 2022

Conversation

mejrs
Copy link
Member

@mejrs mejrs commented Feb 13, 2022

Implements #2129

pyo3-ffi/src/methodobject.rs Outdated Show resolved Hide resolved
pyo3-ffi/src/methodobject.rs Outdated Show resolved Hide resolved
pyo3-ffi/src/methodobject.rs Outdated Show resolved Hide resolved
@davidhewitt
Copy link
Member

Thanks, this does look a bit nicer than the transmutes. I think this needs a CHANGELOG entry!

Comment on lines -79 to -82
impl Default for PyMethodDef {
fn default() -> PyMethodDef {
unsafe { mem::zeroed() }
}
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think this default impl makes sense if PyMethodDefPointer is never null.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed; I also actually generally don't like having any implementations of traits or methods for pyo3-ffi types if possible (except for Copy & Clone). Makes it closer to the C that they come from.

@mejrs mejrs changed the title Implement nl_meth as an union. Implement ml_meth as an union. Feb 14, 2022
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.

LGTM, thanks!

@davidhewitt davidhewitt merged commit 7851e86 into PyO3:main Feb 15, 2022
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.

3 participants