mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-03 19:33:07 +03:00
Allow for custom stacklevel in deprecations
This commit is contained in:
parent
d23d56e195
commit
79e0b0b6ad
|
@ -1370,7 +1370,7 @@ def _save(
|
|||
msg = f"cannot write mode {mode} as PNG"
|
||||
raise OSError(msg) from e
|
||||
if outmode == "I":
|
||||
deprecate("Saving I mode images as PNG", 13)
|
||||
deprecate("Saving I mode images as PNG", 13, stacklevel=4)
|
||||
|
||||
#
|
||||
# write minimal PNG file
|
||||
|
|
|
@ -12,6 +12,7 @@ def deprecate(
|
|||
*,
|
||||
action: str | None = None,
|
||||
plural: bool = False,
|
||||
stacklevel: int = 3,
|
||||
) -> None:
|
||||
"""
|
||||
Deprecations helper.
|
||||
|
@ -67,5 +68,5 @@ def deprecate(
|
|||
warnings.warn(
|
||||
f"{deprecated} {is_} deprecated and will be removed in {removed}{action}",
|
||||
DeprecationWarning,
|
||||
stacklevel=3,
|
||||
stacklevel=stacklevel,
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user