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

add support for memoryview objects #3107

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

jakkdl
Copy link

@jakkdl jakkdl commented Jan 26, 2024

Fixes boto/boto3#3423

I know it's been labeled needs-discussion, but I wanted to check if it really was as easy as just modifying a couple isinstance checks, and after trying it and seeing it really was just that I thought I might as well write up a PR for it.

I've been working on piskvorky/smart_open#380 and it would save significant amounts of memory if it was possible to directly pass memoryview objects to botocore.

I opted to modify all cases where I found isinstance.*bytearray in the code, even though boto/boto3#3423 only directly needs the modifications in validate.py and utils.py afaik. But I see no reason not to accept it in all those places.

I also noticed there was no test for bytearray + httpchecksum, and the error message for type validation didn't include str despite the isinstance line above accepting it, so quickly fixed those as well.

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.

support memoryview in all places bytes, bytearray are supported
1 participant