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

Added memoryview support to frombytes() #6974

Merged
merged 1 commit into from
Feb 25, 2023

Conversation

radarhere
Copy link
Member

Resolves #6933. Alternative to #6937

Adds support for using memoryview objects in frombytes(), by changing

if (!PyArg_ParseTuple(args, "y#", &buffer, &bufsize)) {

to use y* instead. This is actually the "recommended way to accept binary data".

See https://bugs.python.org/issue30625 for a discussion about why this change allows memoryview objects to be accepted.

@hugovk hugovk merged commit 053d90a into python-pillow:main Feb 25, 2023
@radarhere radarhere deleted the memoryview branch February 25, 2023 09:51
@Yay295
Copy link
Contributor

Yay295 commented Feb 25, 2023

I think this is missing a call to PyBuffer_Release().

@Yay295 Yay295 mentioned this pull request Feb 25, 2023
@radarhere radarhere mentioned this pull request Feb 26, 2023
@radarhere
Copy link
Member Author

I've created PR #6976 to release the buffer.

@radarhere
Copy link
Member Author

#6976 has now been merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can support for the memoryview type be added as input to _decode (decode.c)?
3 participants