Skip to content

Commit

Permalink
Simplify code by using _accept
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Feb 26, 2022
1 parent c65c1e1 commit 9ec6435
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/PIL/IcnsImagePlugin.py
Expand Up @@ -167,7 +167,7 @@ def __init__(self, fobj):
self.dct = dct = {}
self.fobj = fobj
sig, filesize = nextheader(fobj)
if sig != MAGIC:
if not _accept(sig):
raise SyntaxError("not an icns file")
i = HEADERSIZE
while i < filesize:
Expand Down
2 changes: 1 addition & 1 deletion src/PIL/TiffImagePlugin.py
Expand Up @@ -493,7 +493,7 @@ def __init__(self, ifh=b"II\052\0\0\0\0\0", prefix=None, group=None):
endianness.
:param prefix: Override the endianness of the file.
"""
if ifh[:4] not in PREFIXES:
if not _accept(ifh):
raise SyntaxError(f"not a TIFF file (header {repr(ifh)} not valid)")
self._prefix = prefix if prefix is not None else ifh[:2]
if self._prefix == MM:
Expand Down

0 comments on commit 9ec6435

Please sign in to comment.