Skip to content

Commit

Permalink
don't show rawmode deprecation warning if mode is same as rawmode
Browse files Browse the repository at this point in the history
The "BGR;15" and "BGR;16" modes being deprecated is separate from the "BGR;15" and "BGR;16" rawmodes being deprecated.
  • Loading branch information
Yay295 committed Jun 22, 2024
1 parent edfd376 commit 1463c5a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/PIL/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,12 +432,14 @@ def _getdecoder(
elif not isinstance(args, tuple):
args = (args,)

if decoder_name == "raw" and args[0] in _DEPRECATED_RAWMODES:
deprecate(
f"rawmode {args[0]}",
12,
replacement=f"rawmode {_DEPRECATED_RAWMODES[args[0]]}",
)
if decoder_name == "raw":
rawmode = args[0]
if mode != rawmode and rawmode in _DEPRECATED_RAWMODES:
deprecate(
f"rawmode {rawmode}",
12,
replacement=f"rawmode {_DEPRECATED_RAWMODES[rawmode]}",
)

try:
decoder = DECODERS[decoder_name]
Expand Down

0 comments on commit 1463c5a

Please sign in to comment.