Decoders and encoders subclass PyDecoder and PyEncoder #7801
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.
register_decoder()
andregister_encoder()
state thatdecoder
/encoder
are callables that return an object.Pillow/src/PIL/Image.py
Lines 3527 to 3534 in 912a33f
Pillow/src/PIL/Image.py
Lines 3541 to 3548 in 912a33f
However, if you look at Pillow's source code, it is not a callable, it is just an object.
Pillow/src/PIL/BlpImagePlugin.py
Lines 472 to 476 in 912a33f
Pillow/src/PIL/PpmImagePlugin.py
Lines 362 to 363 in 912a33f
Pillow/src/PIL/DdsImagePlugin.py
Line 569 in 912a33f
Pillow/src/PIL/SgiImagePlugin.py
Line 230 in 912a33f
This PR updates the docstrings, clarifies this by adding type hints, and updates the tests (which did treat the arguments as callables).