Skip to content

Conversation

@RaphaelVRossi
Copy link
Contributor

Changes proposed in this pull request:

  • Closes image when they are copied
  • Since image copied doesn't have 'fp' attribute, a message was logged as "error"

def test_close_graceful(self):
with Image.open("Tests/images/hopper.jpg") as im:
copy = im.copy()
im.close()
Copy link
Member

Choose a reason for hiding this comment

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

This line isn't strictly necessary to test the change. Are you closing im here just to be thorough and ensure that it also doesn't log any errors?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah! 👍

Do not assign new fp attribute to image when closing
@radarhere radarhere changed the title fix: check object Image has attribute 'fp' when closes If absent, do not try to close fp when closing image Nov 17, 2023
@radarhere radarhere merged commit f8d061c into python-pillow:main Nov 24, 2023
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.

3 participants