Skip to content

Commit

Permalink
Use hasattr
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Dec 22, 2024
1 parent 0e3f51d commit e8029df
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/PIL/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ def __enter__(self):
return self

def _close_fp(self):
if getattr(self, "_fp", False):
if hasattr(self, "_fp"):
if self._fp != self.fp:
self._fp.close()
self._fp = DeferredError(ValueError("Operation on closed image"))
Expand Down

0 comments on commit e8029df

Please sign in to comment.