Skip to content

Conversation

@bencevans
Copy link

Changes proposed in this pull request:

  • Adds a type hint for ImageFile.LOAD_TRUNCATED_IMAGES.

    Sets the type to bool, otherwise Literal[False] is assumed causing a lint error when setting ImageFile.LOAD_TRUNCATED_IMAGES = True.

@radarhere
Copy link
Member

Hi. What environment were you in when you saw the error? Believe it or not, here's what I already see with Pillow 12.0.0 in PyCharm.

pycharm

@bencevans
Copy link
Author

Hi! Ah this will teach me for trying out new toys haha. I'm using ty in VS Code. It's interesting it's picked up as a Literal, it seems stricter than other type checkers.

Forgot to include in the original message but also using pillow===12.0.0.

@radarhere
Copy link
Member

Thanks. I can verify that your fix does satisfy ty.

While the change you've suggested here is minor, I expect there will be other ty problems lurking. I'm somewhat hesitant about trying to satisfy multiple type checkers at once, particularly when ty is still in beta.

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