None is also not a valid value

This commit is contained in:
nulano 2022-04-16 17:46:43 +02:00
parent d088c804d0
commit b4b8249c9d
No known key found for this signature in database
GPG Key ID: B650CDF63B705766
2 changed files with 8 additions and 2 deletions

View File

@ -981,6 +981,9 @@ class TestImageFont:
font = self.get_font()
with pytest.warns(DeprecationWarning):
font.getmask2("Hello world", fill=Image.core.fill)
with pytest.raises(TypeError):
with pytest.warns(DeprecationWarning):
font.getmask2("Hello world", fill=None)
@skip_unless_feature("raqm")

View File

@ -64,6 +64,9 @@ except ImportError:
core = _imagingft_not_installed()
_UNSPECIFIED = object()
# FIXME: add support for pilfont2 format (see FontFile.py)
# --------------------------------------------------------------------
@ -602,7 +605,7 @@ class FreeTypeFont:
self,
text,
mode="",
fill=None,
fill=_UNSPECIFIED,
direction=None,
features=None,
language=None,
@ -676,7 +679,7 @@ class FreeTypeFont:
:py:mod:`PIL.Image.core` interface module, and the text offset, the
gap between the starting coordinate and the first marking
"""
if fill is not None:
if fill is not _UNSPECIFIED:
deprecate("fill", 10)
else:
fill = Image.core.fill