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 PyBytesMethods and PyByteArrayMethods #3651

Merged
merged 2 commits into from
Dec 19, 2023

Conversation

davidhewitt
Copy link
Member

Implements PyBytesMethods and PyByteArrayMethods traits as per #3382

The main interesting thing here is that to be able to forward the .as_bytes() and .as_bytes_mut() methods from the gil refs to the underlying types, I had to extend the lifetime of the returned slices. Unclear to me if there's a way to change things to not need this.

@davidhewitt davidhewitt added the CI-skip-changelog Skip checking changelog entry label Dec 14, 2023
src/types/bytes.rs Outdated Show resolved Hide resolved
src/instance.rs Outdated Show resolved Hide resolved
Copy link
Member

@adamreichold adamreichold left a comment

Choose a reason for hiding this comment

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

LGTM except for the stray TODO comment

@davidhewitt
Copy link
Member Author

Thanks again for all the reviews this week, I'm really excited to have some momentum on the new API!

@davidhewitt davidhewitt added this pull request to the merge queue Dec 19, 2023
@adamreichold
Copy link
Member

@davidhewitt Won't this fail due to the Clippy warning for the self convention on Py2Borrowed<PyBytes>::as_bytes?

@davidhewitt davidhewitt removed this pull request from the merge queue due to a manual request Dec 19, 2023
@davidhewitt
Copy link
Member Author

Oh yikes, probably, yes. I've cancelled the merge and will fixup. Good catch!

@davidhewitt davidhewitt added this pull request to the merge queue Dec 19, 2023
Merged via the queue into PyO3:main with commit 54ba6e8 Dec 19, 2023
36 of 37 checks passed
@davidhewitt davidhewitt deleted the bytes2 branch December 19, 2023 20:39
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