File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -236,9 +236,12 @@ font_set_linesize(PyObject *self, PyObject *arg)
236236#if SDL_TTF_VERSION_ATLEAST (2 , 24 , 0 )
237237 TTF_Font * font = PyFont_AsFont (self );
238238 int linesize = PyLong_AsLong (arg );
239- if (linesize < 0 || PyErr_Occurred ()) {
239+ if (PyErr_Occurred ())
240+ return NULL ;
241+
242+ if (linesize < 0 )
240243 return RAISE (PyExc_ValueError , "linesize must be >= 0" );
241- }
244+
242245 TTF_SetFontLineSkip (font , linesize );
243246
244247 Py_RETURN_NONE ;
Original file line number Diff line number Diff line change @@ -901,7 +901,6 @@ def test_font_method_should_raise_exception_after_quit(self):
901901 ("get_descent" , ()),
902902 ("get_ascent" , ()),
903903 ("get_linesize" , ()),
904- ("set_linesize" , (2 ,)),
905904 ("get_bold" , ()),
906905 ("set_bold" , (True ,)),
907906 ("get_italic" , ()),
@@ -919,6 +918,11 @@ def test_font_method_should_raise_exception_after_quit(self):
919918 skip_methods = set ()
920919 version = pygame .font .get_sdl_ttf_version ()
921920 if version >= (2 , 0 , 18 ):
921+ if version >= (2 , 24 , 0 ):
922+ methods .append (("set_linesize" , (2 ,)))
923+ else :
924+ skip_methods .add ("set_linesize" )
925+
922926 methods .append (("get_point_size" , ()))
923927 methods .append (("set_point_size" , (34 ,)))
924928 else :
You can’t perform that action at this time.
0 commit comments