Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/PIL/TiffImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -920,20 +920,20 @@ def load(self, fp: IO[bytes]) -> None:
if tag in self._tagdata:
continue

tagname = TiffTags.lookup(tag, self.group).name
typname = TYPES.get(typ, "unknown")
msg = f"tag: {tagname} ({tag}) - type: {typname} ({typ})"
# tagname = TiffTags.lookup(tag, self.group).name
# typname = TYPES.get(typ, "unknown")
# msg = f"tag: {tagname} ({tag}) - type: {typname} ({typ})"

try:
unit_size, handler = self._load_dispatch[typ]
except KeyError:
logger.debug("%s - unsupported type %s", msg, typ)
# logger.debug("%s - unsupported type %s", msg, typ)
continue # ignore unsupported type
size = count * unit_size
if size > (8 if self._bigtiff else 4):
here = fp.tell()
(offset,) = self._unpack("Q" if self._bigtiff else "L", data)
msg += f" Tag Location: {here} - Data Location: {offset}"
# msg += f" Tag Location: {here} - Data Location: {offset}"
if offset >= 2**63:
warnings.warn("Tag offset too large")
continue
Expand All @@ -956,20 +956,20 @@ def load(self, fp: IO[bytes]) -> None:
f"Expecting to read {size} bytes but only got {len(data)}."
f" Skipping tag {tag}"
)
logger.debug(msg)
# logger.debug(msg)
continue

if not data:
logger.debug(msg)
# logger.debug(msg)
continue

self._tagdata[tag] = data
self.tagtype[tag] = typ

msg += " - value: "
msg += f"<table: {size} bytes>" if size > 32 else repr(data)
# msg += " - value: "
# msg += f"<table: {size} bytes>" if size > 32 else repr(data)

logger.debug(msg)
# logger.debug(msg)

(self.next,) = (
self._unpack("Q", self._ensure_read(fp, 8))
Expand Down
Loading