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

Allow #[new] to return existing instances #3287

Merged
merged 1 commit into from Jul 3, 2023

Conversation

alex
Copy link
Contributor

@alex alex commented Jul 2, 2023

fixes #2384

@alex alex force-pushed the existing-instance branch 2 times, most recently from 9827db4 to ace5554 Compare July 2, 2023 21:30
src/pyclass_init.rs Outdated Show resolved Hide resolved
src/pyclass_init.rs Outdated Show resolved Hide resolved
@alex alex force-pushed the existing-instance branch 2 times, most recently from 73429da to 98709c2 Compare July 2, 2023 21:48
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! While it's a subset of the full functionality I was thinking in #3287, it will be forwards-compatible with extending #[new] to allow any T: IntoPy<PyObject> so am happy to merge this as it unblocks users.

@davidhewitt davidhewitt added this pull request to the merge queue Jul 3, 2023
Merged via the queue into PyO3:main with commit da7c031 Jul 3, 2023
32 checks passed
@alex alex deleted the existing-instance branch July 3, 2023 11:10
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.

Allow #[new] to return existing objects
3 participants