mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-03 22:06:18 +03:00
Use hasattr
This commit is contained in:
parent
e005bcf8f2
commit
957db67d43
|
@ -173,8 +173,8 @@ class ImageFile(Image.Image):
|
|||
return self
|
||||
|
||||
def _close_fp(self) -> None:
|
||||
if getattr(self, "_fp", False):
|
||||
if self._fp != self.fp and not isinstance(self._fp, DeferredError):
|
||||
if hasattr(self, "_fp") and not isinstance(self._fp, DeferredError):
|
||||
if self._fp != self.fp:
|
||||
self._fp.close()
|
||||
self._fp = DeferredError(ValueError("Operation on closed image"))
|
||||
if self.fp:
|
||||
|
|
Loading…
Reference in New Issue
Block a user