Skip to content

Commit

Permalink
Merge pull request #8579 from radarhere/tiff_debug
Browse files Browse the repository at this point in the history
Do not describe raw data as a table
  • Loading branch information
hugovk authored Dec 16, 2024
2 parents e40033d + c16ae6f commit 2c120b5
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/PIL/TiffImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -935,8 +935,8 @@ def load(self, fp: IO[bytes]) -> None:
self._tagdata[tag] = data
self.tagtype[tag] = typ

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

logger.debug(msg)

Expand Down Expand Up @@ -981,11 +981,8 @@ def tobytes(self, offset: int = 0) -> bytes:

tagname = TiffTags.lookup(tag, self.group).name
typname = "ifd" if is_ifd else TYPES.get(typ, "unknown")
bytes_value = len(data) if len(data) >= 16 else str(values)
msg = (
f"save: {tagname} ({tag}) - type: {typname} ({typ})"
f" - value: <table: {bytes_value} bytes>"
)
msg = f"save: {tagname} ({tag}) - type: {typname} ({typ}) - value: "
msg += f"<table: {len(data)} bytes>" if len(data) >= 16 else str(values)
logger.debug(msg)

# count is sum of lengths for string and arbitrary data
Expand Down

0 comments on commit 2c120b5

Please sign in to comment.