protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

python: support passing `memoryview` to `bytes` fields

Open fandreuz opened this issue 2 years ago • 5 comments

memoryview is not immutable, but a similar functionality is offered for similar types in other languages (e.g. Java's UnsafeByteOperations). An alternative way to implement this would be to provide a custom type (something like UnsafeBytes) to wrap buffer-like objects, and to let bytes field accept this object; so the user demonstrates to be well aware of what they are doing.

Fixes #6782

fandreuz avatar Nov 27 '23 01:11 fandreuz

I've just ran the CI and it seems many tests are broken, for example with TypeError: '<' not supported between instances of 'memoryview' and 'memoryview', could you please take a look?

Are you having issues with your local bazel build? Could you try rebasing your PR, and using the latest supported Bazel version?

hlopko avatar Dec 15 '23 14:12 hlopko

Hi @hlopko, thanks for your reply. I've managed to run the tests locally and fixed the problems you mentioned in a6a1b26. However, I still can't figure out how to run the tests with upb backend, do you have any suggestion? Thanks!

fandreuz avatar Dec 17 '23 10:12 fandreuz

We triage inactive PRs and issues in order to make it easier to find active work. If this PR should remain active, please add a comment.

This PR is labeled inactive because the last activity was over 90 days ago. This PR will be closed and archived after 14 additional days without activity.

github-actions[bot] avatar Mar 27 '24 10:03 github-actions[bot]

Hi @hlopko, any chance we could resume the review of this PR? Thanks!

fandreuz avatar Mar 27 '24 10:03 fandreuz

We triage inactive PRs and issues in order to make it easier to find active work. If this PR should remain active, please add a comment.

This PR is labeled inactive because the last activity was over 90 days ago. This PR will be closed and archived after 14 additional days without activity.

github-actions[bot] avatar Jun 26 '24 10:06 github-actions[bot]

We triage inactive PRs and issues in order to make it easier to find active work. If this PR should remain active or becomes active again, please reopen it.

This PR was closed and archived because there has been no new activity in the 14 days since the inactive label was added.

github-actions[bot] avatar Jul 10 '24 10:07 github-actions[bot]