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

Fix being able to call arg-less #[new] with any args from Python #2749

Merged
merged 2 commits into from Nov 20, 2022

Conversation

birkenfeld
Copy link
Member

Fixes #2748

Note that the removed check only triggered for #[new] anyway, since other arg-less pymethods use the NOARGS argument convention which is not available for tp_new.

There's some confusion going on with the py argument, I'll open an issue for that.

@birkenfeld
Copy link
Member Author

Oh great, another MSRV bump (rayon-core) in a semver-compatible version bump. To the 2021 edition nonetheless.

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.

Ooof, thanks for fixing!

@birkenfeld
Copy link
Member Author

Hmm, that test failure is interesting. The base class' __new__ is called implicitly, it seems, with the same arguments?

@birkenfeld
Copy link
Member Author

Added a bit to the guide that explains the behavior.

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.

Thanks, this is definitely a correct fix and it's good to document existing behaviour.

I think there's potential for improvement around how to control invocation of __new__ and __init__ with inheritance, however I don't have a good answer for that right now and it's definitely for a future discussion anyway.

@davidhewitt davidhewitt merged commit 8ca41be into main Nov 20, 2022
@davidhewitt davidhewitt deleted the 2748-fix branch November 20, 2022 11:39
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.

Generated __new__ method does not check args to enforce signature
2 participants