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 @@ -215,9 +215,12 @@ font_set_linesize(PyObject *self, PyObject *arg)
215
215
#if SDL_TTF_VERSION_ATLEAST (2 , 24 , 0 )
216
216
TTF_Font * font = PyFont_AsFont (self );
217
217
int linesize = PyLong_AsLong (arg );
218
- if (linesize < 0 || PyErr_Occurred ()) {
218
+ if (PyErr_Occurred ())
219
+ return NULL ;
220
+
221
+ if (linesize < 0 )
219
222
return RAISE (PyExc_ValueError , "linesize must be >= 0" );
220
- }
223
+
221
224
TTF_SetFontLineSkip (font , linesize );
222
225
223
226
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):
901
901
("get_descent" , ()),
902
902
("get_ascent" , ()),
903
903
("get_linesize" , ()),
904
- ("set_linesize" , (2 ,)),
905
904
("get_bold" , ()),
906
905
("set_bold" , (True ,)),
907
906
("get_italic" , ()),
@@ -919,6 +918,11 @@ def test_font_method_should_raise_exception_after_quit(self):
919
918
skip_methods = set ()
920
919
version = pygame .font .get_sdl_ttf_version ()
921
920
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
+
922
926
methods .append (("get_point_size" , ()))
923
927
methods .append (("set_point_size" , (34 ,)))
924
928
else :
You can’t perform that action at this time.
0 commit comments