Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed ContainerIO to subclass IO #8240

Merged
merged 1 commit into from
Jul 17, 2024
Merged

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
50 of 51 checks passed
@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