Skip to content

Commit 56324c3

Browse files
committed
Simplify code by using _accept
1 parent e228835 commit 56324c3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/PIL/IcnsImagePlugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def __init__(self, fobj):
167167
self.dct = dct = {}
168168
self.fobj = fobj
169169
sig, filesize = nextheader(fobj)
170-
if sig != MAGIC:
170+
if not _accept(sig):
171171
raise SyntaxError("not an icns file")
172172
i = HEADERSIZE
173173
while i < filesize:

src/PIL/TiffImagePlugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ def __init__(self, ifh=b"II\052\0\0\0\0\0", prefix=None, group=None):
493493
endianness.
494494
:param prefix: Override the endianness of the file.
495495
"""
496-
if ifh[:4] not in PREFIXES:
496+
if not _accept(ifh):
497497
raise SyntaxError(f"not a TIFF file (header {repr(ifh)} not valid)")
498498
self._prefix = prefix if prefix is not None else ifh[:2]
499499
if self._prefix == MM:

0 commit comments

Comments
 (0)