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() font = self.get_font()
with pytest.warns(DeprecationWarning): with pytest.warns(DeprecationWarning):
font.getmask2("Hello world", fill=Image.core.fill) 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") @skip_unless_feature("raqm")

View File

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