Skip to content

Conversation

@radarhere
Copy link
Member

There is a mypy error on Tests/test_file_tar.py

Tests/test_file_tar.py:25: error: Argument 1 to "open" has incompatible type "TarIO"; expected "Union[Union[str, bytes, PathLike[str], PathLike[bytes]], IO[bytes]]" 
[arg-type]
                with Image.open(tar) as im:
                                ^~~
Found 1 error in 1 file (checked 1 source file)

Pillow/src/PIL/Image.py

Lines 3357 to 3358 in 86f4cfb

def open(
fp: StrOrBytesPath | IO[bytes],

doesn't accept TarIO, which subclasses from ContainerIO

class ContainerIO(Generic[AnyStr]):

I don't think there's any reason why ContainerIO shouldn't subclass IO - it is essentially performing that role - so I've made that change here.

@hugovk hugovk merged commit d052621 into python-pillow:main Jul 17, 2024
@radarhere radarhere deleted the containerio branch July 17, 2024 11:27
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.

2 participants