Skip to content

implement PyBytesMethods and PyByteArrayMethods#3651

Merged
davidhewitt merged 2 commits intoPyO3:mainfrom
davidhewitt:bytes2
Dec 19, 2023
Merged

implement PyBytesMethods and PyByteArrayMethods#3651
davidhewitt merged 2 commits intoPyO3:mainfrom
davidhewitt:bytes2

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
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
@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