Replaced IOError with OSError

This commit is contained in:
Andrew Murray 2022-11-05 15:41:17 +11:00
parent 1c57ab8429
commit 51d95add6a
3 changed files with 3 additions and 3 deletions

View File

@ -59,6 +59,6 @@ def test_fuzz_fonts(path):
fuzzers.fuzz_font(f.read()) fuzzers.fuzz_font(f.read())
except (Image.DecompressionBombError, except (Image.DecompressionBombError,
Image.DecompressionBombWarning, Image.DecompressionBombWarning,
IOError): OSError):
pass pass
assert True assert True

View File

@ -17,6 +17,6 @@ class TestFontCrash:
@skip_unless_feature("freetype2") @skip_unless_feature("freetype2")
def test_segfault(self): def test_segfault(self):
with pytest.raises(IOError): with pytest.raises(OSError):
font = ImageFont.truetype("Tests/fonts/fuzz_font-5203009437302784") font = ImageFont.truetype("Tests/fonts/fuzz_font-5203009437302784")
self._fuzz_font(font) self._fuzz_font(font)

View File

@ -923,7 +923,7 @@ font_render(FontObject *self, PyObject *args) {
// Null buffer, is dereferenced in FT_Bitmap_Convert // Null buffer, is dereferenced in FT_Bitmap_Convert
if (!bitmap.buffer && bitmap.rows) { if (!bitmap.buffer && bitmap.rows) {
PyErr_SetString(PyExc_IOError, "Bitmap missing for glyph"); PyErr_SetString(PyExc_OSError, "Bitmap missing for glyph");
goto glyph_error; goto glyph_error;
} }