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 new API for PyNone #3684 #3793

Merged
merged 9 commits into from
Feb 4, 2024
Merged

Conversation

snuderl
Copy link
Contributor

@snuderl snuderl commented Feb 3, 2024

Add get_bound method to PyNone and deprecate existing one.

@davidhewitt davidhewitt added the CI-skip-changelog Skip checking changelog entry label Feb 3, 2024
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.

Thank you for joining in with our implementation of the new API! I've been wondering a bit about what to do with PyNone (and similar for PyNotImplemented and PyEllipsis, though we can save them for a future PR). I've written some comments below which might be a sensible way for us to migrate PyNone while taking care not to break users too much. What do you think of those suggestions?

src/types/none.rs Outdated Show resolved Hide resolved
src/types/none.rs Outdated Show resolved Hide resolved
src/marker.rs Outdated Show resolved Hide resolved
@snuderl
Copy link
Contributor Author

snuderl commented Feb 3, 2024

Thank you for joining in with our implementation of the new API! I've been wondering a bit about what to do with PyNone (and similar for PyNotImplemented and PyEllipsis, though we can save them for a future PR). I've written some comments below which might be a sensible way for us to migrate PyNone while taking care not to break users too much. What do you think of those suggestions?

Hey @davidhewitt .

You managed to pick this up before I even had a chance to pull up the full PR :) I first wanted to just see the CI run and see what is red.

I totally agree about the breaking changes and will add new methods instead.

@davidhewitt
Copy link
Member

No problem, I could see you were still working on it, I just hoped that you might be spared some of the CI pain if I put some ideas down regarding the breaking bits!

Copy link

codspeed-hq bot commented Feb 4, 2024

CodSpeed Performance Report

Merging #3793 will degrade performances by 19.44%

Comparing snuderl:PyNone-new-api (eca943e) with main (975f182)

Summary

⚡ 1 improvements
❌ 1 regressions
✅ 77 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main snuderl:PyNone-new-api Change
drop_many_objects 55.3 µs 68.6 µs -19.44%
not_a_list_via_downcast 270.6 ns 242.8 ns +11.44%

@snuderl
Copy link
Contributor Author

snuderl commented Feb 4, 2024

Well not breaking any public api's indeed does end up being much simpler :)

This is probably everything assuming we will wait with migrating the public api for a future version

@snuderl snuderl requested a review from davidhewitt February 4, 2024 07:41
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.

Thank you, this looks good to me! Yes, in particular PyNone::get() is probably used a lot less than py.None(), so staying away from changing py.None() seems like a very good idea for now 😂

Would you be interested in doing similar PRs for PyNotImplemented and PyEllipsis? Those singletons work in exactly the same way as PyNone.

@davidhewitt davidhewitt marked this pull request as ready for review February 4, 2024 14:20
@davidhewitt davidhewitt added this pull request to the merge queue Feb 4, 2024
Merged via the queue into PyO3:main with commit cd9c21f Feb 4, 2024
38 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI-skip-changelog Skip checking changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants