Pass file handle to ContainerIO by radarhere · Pull Request #8625 · python-pillow/Pillow
This is part of #8362 - I'm hoping to break down that PR into easier-to-review chunks.
#7656 set ContainerIO to receive IO as the type of the first argument.
| def __init__(self, file: IO[AnyStr], offset: int, length: int) -> None: |
Currently, test_file_container.py passes an image instance to it sometimes - the wrong type.
| with hopper() as im: | |
| container = ContainerIO.ContainerIO(im, 0, 0) |
This PR fixes that, passing a file handle to it like the rest of the test file does.
| with open(TEST_FILE, "rb") as fh: | |
| container = ContainerIO.ContainerIO(fh, 22, 100) |