Skip to content

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