Skip to content

Commit a4f5fea

Browse files
authored
Merge pull request #8794 from radarhere/outline
Image.core.outline will no longer raise an AttributeError
2 parents 4e550d4 + a1a467b commit a4f5fea

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

Tests/test_imagedraw.py

-4
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,6 @@ def test_shape1() -> None:
448448
x3, y3 = 95, 5
449449

450450
# Act
451-
assert ImageDraw.Outline is not None
452451
s = ImageDraw.Outline()
453452
s.move(x0, y0)
454453
s.curve(x1, y1, x2, y2, x3, y3)
@@ -470,7 +469,6 @@ def test_shape2() -> None:
470469
x3, y3 = 5, 95
471470

472471
# Act
473-
assert ImageDraw.Outline is not None
474472
s = ImageDraw.Outline()
475473
s.move(x0, y0)
476474
s.curve(x1, y1, x2, y2, x3, y3)
@@ -489,7 +487,6 @@ def test_transform() -> None:
489487
draw = ImageDraw.Draw(im)
490488

491489
# Act
492-
assert ImageDraw.Outline is not None
493490
s = ImageDraw.Outline()
494491
s.line(0, 0)
495492
s.transform((0, 0, 0, 0, 0, 0))
@@ -1526,7 +1523,6 @@ def test_same_color_outline(bbox: Coords) -> None:
15261523
x2, y2 = 95, 50
15271524
x3, y3 = 95, 5
15281525

1529-
assert ImageDraw.Outline is not None
15301526
s = ImageDraw.Outline()
15311527
s.move(x0, y0)
15321528
s.curve(x1, y1, x2, y2, x3, y3)

src/PIL/ImageDraw.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,7 @@
4242
from ._typing import Coords
4343

4444
# experimental access to the outline API
45-
Outline: Callable[[], Image.core._Outline] | None
46-
try:
47-
Outline = Image.core.outline
48-
except AttributeError:
49-
Outline = None
45+
Outline: Callable[[], Image.core._Outline] = Image.core.outline
5046

5147
if TYPE_CHECKING:
5248
from . import ImageDraw2, ImageFont

0 commit comments

Comments
 (0)