Conversation
The `ImagingNew2Dirty` internal API was ugly because there was no way to tell whether it had actually allocated new memory or not, and as a result, some conversion functions could free memory that belonged to the caller. * `ImagingConvert` no longer takes an output image; it always returns a newly allocated image. The new `ImagingConvertBlock` does the same, but allocates a single contiguous block. * At the C extension surface, `convert_into(image)` (used only by `ImageTk.PhotoImage.paste`) is replaced by `convert_block(mode)`, which returns a new block image converted into the given mode. * `ImagingCopy2` is renamed to `ImagingCopyInto`, and only copies into an existing image; `ImagingCopy` always allocates a new image.
Contributor
Author
|
Hm, @radarhere, now that I think of it: removing |
Member
|
As long as the Python API stays the same, it should be fine. The function isn't exactly complex, should we ever need that functionality again and want to restore it. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I was looking at documenting some of the internal functions in the wake of looking at #10075 and #10098 and stumbled upon
ImagingNew2Dirtyand realized... that's not right.Refs #9910 (which just recently renamed
convert2intoconvert_into).The
ImagingNew2Dirtyinternal API was ugly because there was no way to tell whether it had actually allocated new memory or not, and as a result, some conversion functions could free memory that belonged to the caller.ImagingConvertno longer takes an output image; it always returns a newly allocated image. The newImagingConvertBlockdoes the same, but allocates a single contiguous block.convert_into(image)(used only byImageTk.PhotoImage.paste) is replaced byconvert_block(mode), which returns a new block image converted into the given mode.ImagingCopy2is renamed toImagingCopyInto, and only copies into an existing image;ImagingCopyalways allocates a new image.