File tree 1 file changed +12
-9
lines changed 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -303,31 +303,34 @@ text_layout_raqm(
303
303
goto failed ;
304
304
}
305
305
306
- len = PySequence_Size (seq );
306
+ len = PySequence_Fast_GET_SIZE (seq );
307
307
for (j = 0 ; j < len ; j ++ ) {
308
308
PyObject * item = PySequence_Fast_GET_ITEM (seq , j );
309
309
char * feature = NULL ;
310
310
Py_ssize_t size = 0 ;
311
311
PyObject * bytes ;
312
312
313
313
if (!PyUnicode_Check (item )) {
314
+ Py_DECREF (seq );
314
315
PyErr_SetString (PyExc_TypeError , "expected a string" );
315
316
goto failed ;
316
317
}
317
-
318
- if (PyUnicode_Check (item )) {
319
- bytes = PyUnicode_AsUTF8String (item );
320
- if (bytes == NULL ) {
321
- goto failed ;
322
- }
323
- feature = PyBytes_AS_STRING (bytes );
324
- size = PyBytes_GET_SIZE (bytes );
318
+ bytes = PyUnicode_AsUTF8String (item );
319
+ if (bytes == NULL ) {
320
+ Py_DECREF (seq );
321
+ goto failed ;
325
322
}
323
+ feature = PyBytes_AS_STRING (bytes );
324
+ size = PyBytes_GET_SIZE (bytes );
326
325
if (!raqm_add_font_feature (rq , feature , size )) {
326
+ Py_DECREF (seq );
327
+ Py_DECREF (bytes );
327
328
PyErr_SetString (PyExc_ValueError , "raqm_add_font_feature() failed" );
328
329
goto failed ;
329
330
}
331
+ Py_DECREF (bytes );
330
332
}
333
+ Py_DECREF (seq );
331
334
}
332
335
333
336
if (!raqm_set_freetype_face (rq , self -> face )) {
You can’t perform that action at this time.
0 commit comments