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