@@ -327,7 +327,7 @@ getfont(PyObject* self_, PyObject* args, PyObject* kw)
327
327
static int
328
328
font_getchar (PyObject * string , int index , FT_ULong * char_out )
329
329
{
330
- #if PY_VERSION_HEX < 0x03000000
330
+ #if ( PY_VERSION_HEX < 0x03030000 ) || (defined( PYPY_VERSION_NUM ))
331
331
if (PyUnicode_Check (string )) {
332
332
Py_UNICODE * p = PyUnicode_AS_UNICODE (string );
333
333
int size = PyUnicode_GET_SIZE (string );
@@ -336,7 +336,7 @@ font_getchar(PyObject* string, int index, FT_ULong* char_out)
336
336
* char_out = p [index ];
337
337
return 1 ;
338
338
}
339
-
339
+ #if PY_VERSION_HEX < 0x03000000
340
340
if (PyString_Check (string )) {
341
341
unsigned char * p = (unsigned char * ) PyString_AS_STRING (string );
342
342
int size = PyString_GET_SIZE (string );
@@ -345,6 +345,7 @@ font_getchar(PyObject* string, int index, FT_ULong* char_out)
345
345
* char_out = (unsigned char ) p [index ];
346
346
return 1 ;
347
347
}
348
+ #endif
348
349
#else
349
350
if (PyUnicode_Check (string )) {
350
351
if (index >= PyUnicode_GET_LENGTH (string ))
@@ -373,7 +374,7 @@ text_layout_raqm(PyObject* string, FontObject* self, const char* dir, PyObject *
373
374
goto failed ;
374
375
}
375
376
376
- #if PY_VERSION_HEX < 0x03000000
377
+ #if ( PY_VERSION_HEX < 0x03030000 ) || (defined( PYPY_VERSION_NUM ))
377
378
if (PyUnicode_Check (string )) {
378
379
Py_UNICODE * text = PyUnicode_AS_UNICODE (string );
379
380
Py_ssize_t size = PyUnicode_GET_SIZE (string );
@@ -392,8 +393,9 @@ text_layout_raqm(PyObject* string, FontObject* self, const char* dir, PyObject *
392
393
goto failed ;
393
394
}
394
395
}
395
-
396
- } else if (PyString_Check (string )) {
396
+ }
397
+ #if PY_VERSION_HEX < 0x03000000
398
+ else if (PyString_Check (string )) {
397
399
char * text = PyString_AS_STRING (string );
398
400
int size = PyString_GET_SIZE (string );
399
401
if (! size ) {
@@ -410,6 +412,7 @@ text_layout_raqm(PyObject* string, FontObject* self, const char* dir, PyObject *
410
412
}
411
413
}
412
414
}
415
+ #endif
413
416
#else
414
417
if (PyUnicode_Check (string )) {
415
418
Py_UCS4 * text = PyUnicode_AsUCS4Copy (string );
0 commit comments