don't show rawmode deprecation warning if mode is same as rawmode

The "BGR;15" and "BGR;16" modes being deprecated is separate from the "BGR;15" and "BGR;16" rawmodes being deprecated.
This commit is contained in:
Yay295 2024-06-22 10:23:25 -05:00
parent d330a136cd
commit 976f30709a

View File

@ -440,12 +440,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]