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

deprecate PyWeakRefMethods::get_object #4597

Merged
merged 5 commits into from
Oct 10, 2024

Conversation

davidhewitt
Copy link
Member

While looking deeper at #4590 I noticed that we had this odd inefficiency in the weakref bindings where .upgrade() was the main method, which returns an Option. However it got that Option by calling .get_object(), which returns Python None, and checking for it.

This PR proposes to remove the inefficient None-checking dance by deprecating get_object and making upgrade() the method which is implemented directly.

@davidhewitt davidhewitt added this pull request to the merge queue Oct 10, 2024
Merged via the queue into PyO3:main with commit 446676d Oct 10, 2024
41 of 42 checks passed
@davidhewitt davidhewitt deleted the weakref-get-object-option branch October 10, 2024 11:59
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.

2 participants