Removed ImageDraw.getdraw hints parameter

This commit is contained in:
Andrew Murray 2025-07-01 20:14:26 +10:00
parent 88018c1c2d
commit a7e00fba8b
3 changed files with 9 additions and 12 deletions

View File

@ -1732,8 +1732,3 @@ def test_incorrectly_ordered_coordinates(xy: tuple[int, int, int, int]) -> None:
draw.rectangle(xy) draw.rectangle(xy)
with pytest.raises(ValueError): with pytest.raises(ValueError):
draw.rounded_rectangle(xy) draw.rounded_rectangle(xy)
def test_getdraw() -> None:
with pytest.warns(DeprecationWarning, match="'hints' parameter"):
ImageDraw.getdraw(None, [])

View File

@ -168,6 +168,14 @@ Removed features
Deprecated features are only removed in major releases after an appropriate Deprecated features are only removed in major releases after an appropriate
period of deprecation has passed. period of deprecation has passed.
ImageDraw.getdraw hints parameter
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. deprecated:: 10.4.0
.. versionremoved:: 12.0.0
The ``hints`` parameter in :py:meth:`~PIL.ImageDraw.getdraw()` has been removed.
ImageFile.raise_oserror ImageFile.raise_oserror
~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -38,7 +38,6 @@ from types import ModuleType
from typing import Any, AnyStr, Callable, Union, cast from typing import Any, AnyStr, Callable, Union, cast
from . import Image, ImageColor from . import Image, ImageColor
from ._deprecate import deprecate
from ._typing import Coords from ._typing import Coords
# experimental access to the outline API # experimental access to the outline API
@ -1009,16 +1008,11 @@ def Draw(im: Image.Image, mode: str | None = None) -> ImageDraw:
return ImageDraw(im, mode) return ImageDraw(im, mode)
def getdraw( def getdraw(im: Image.Image | None = None) -> tuple[ImageDraw2.Draw | None, ModuleType]:
im: Image.Image | None = None, hints: list[str] | None = None
) -> tuple[ImageDraw2.Draw | None, ModuleType]:
""" """
:param im: The image to draw in. :param im: The image to draw in.
:param hints: An optional list of hints. Deprecated.
:returns: A (drawing context, drawing resource factory) tuple. :returns: A (drawing context, drawing resource factory) tuple.
""" """
if hints is not None:
deprecate("'hints' parameter", 12)
from . import ImageDraw2 from . import ImageDraw2
draw = ImageDraw2.Draw(im) if im is not None else None draw = ImageDraw2.Draw(im) if im is not None else None