Skip to content

Conversation

@radarhere
Copy link
Member

No description provided.

def __exit__(self, exc_type, exc_value, traceback):
def __exit__(self, *args: object) -> None:
self.close()
return False # do not suppress exceptions
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://python.readthedocs.io/en/latest/reference/datamodel.html#object.__exit__

If an exception is supplied, and the method wishes to suppress the exception (i.e., prevent it from being propagated), it should return a true value. Otherwise, the exception will be processed normally upon exit from this method.

So False and None will have the same result.

@hugovk hugovk merged commit 114e017 into python-pillow:main Jun 11, 2024
@radarhere radarhere deleted the type_hint branch June 11, 2024 22:40
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