@@ -249,7 +249,7 @@ static int unicode_modifiable(PyObject *unicode);
249249
250250
251251static PyObject *
252- _PyUnicode_FromUCS1 (const unsigned char * s , Py_ssize_t size );
252+ _PyUnicode_FromUCS1 (const Py_UCS1 * s , Py_ssize_t size );
253253static PyObject *
254254_PyUnicode_FromUCS2 (const Py_UCS2 * s , Py_ssize_t size );
255255static PyObject *
@@ -442,7 +442,7 @@ unicode_result_wchar(PyObject *unicode)
442442
443443 if (len == 1 ) {
444444 wchar_t ch = _PyUnicode_WSTR (unicode )[0 ];
445- if (ch < 256 ) {
445+ if (( Py_UCS4 ) ch < 256 ) {
446446 PyObject * latin1_char = get_latin1_char ((unsigned char )ch );
447447 Py_DECREF (unicode );
448448 return latin1_char ;
@@ -1761,7 +1761,7 @@ PyUnicode_FromUnicode(const Py_UNICODE *u, Py_ssize_t size)
17611761
17621762 /* Single character Unicode objects in the Latin-1 range are
17631763 shared when using this constructor */
1764- if (size == 1 && * u < 256 )
1764+ if (size == 1 && ( Py_UCS4 ) * u < 256 )
17651765 return get_latin1_char ((unsigned char )* u );
17661766
17671767 /* If not empty and not single character, copy the Unicode data
@@ -1869,7 +1869,7 @@ _PyUnicode_FromASCII(const char *buffer, Py_ssize_t size)
18691869 PyObject * unicode ;
18701870 if (size == 1 ) {
18711871#ifdef Py_DEBUG
1872- assert (s [0 ] < 128 );
1872+ assert (( unsigned char ) s [0 ] < 128 );
18731873#endif
18741874 return get_latin1_char (s [0 ]);
18751875 }
@@ -1911,7 +1911,7 @@ align_maxchar(Py_UCS4 maxchar)
19111911}
19121912
19131913static PyObject *
1914- _PyUnicode_FromUCS1 (const unsigned char * u , Py_ssize_t size )
1914+ _PyUnicode_FromUCS1 (const Py_UCS1 * u , Py_ssize_t size )
19151915{
19161916 PyObject * res ;
19171917 unsigned char max_char ;
@@ -2974,8 +2974,8 @@ PyUnicode_FromOrdinal(int ordinal)
29742974 return NULL ;
29752975 }
29762976
2977- if (ordinal < 256 )
2978- return get_latin1_char (ordinal );
2977+ if (( Py_UCS4 ) ordinal < 256 )
2978+ return get_latin1_char (( unsigned char ) ordinal );
29792979
29802980 v = PyUnicode_New (1 , ordinal );
29812981 if (v == NULL )
0 commit comments