Commit e2520958 authored by Stefan Behnel's avatar Stefan Behnel

Disable Py_UNICODE fallback for __Pyx_UnicodeContainsUCS4() in Py3.9 since...

Disable Py_UNICODE fallback for __Pyx_UnicodeContainsUCS4() in Py3.9 since Py_UNICODE is deprecated and PEP-393 unicode is practically required.
parent 7540f7e9
...@@ -66,6 +66,7 @@ static CYTHON_INLINE int __Pyx_UnicodeContainsUCS4(PyObject* unicode, Py_UCS4 ch ...@@ -66,6 +66,7 @@ static CYTHON_INLINE int __Pyx_UnicodeContainsUCS4(PyObject* unicode, Py_UCS4 ch
//////////////////// PyUCS4InUnicode //////////////////// //////////////////// PyUCS4InUnicode ////////////////////
#if PY_VERSION_HEX < 0x03090000
#if Py_UNICODE_SIZE == 2 #if Py_UNICODE_SIZE == 2
static int __Pyx_PyUnicodeBufferContainsUCS4_SP(Py_UNICODE* buffer, Py_ssize_t length, Py_UCS4 character) { static int __Pyx_PyUnicodeBufferContainsUCS4_SP(Py_UNICODE* buffer, Py_ssize_t length, Py_UCS4 character) {
/* handle surrogate pairs for Py_UNICODE buffers in 16bit Unicode builds */ /* handle surrogate pairs for Py_UNICODE buffers in 16bit Unicode builds */
...@@ -89,6 +90,7 @@ static int __Pyx_PyUnicodeBufferContainsUCS4_BMP(Py_UNICODE* buffer, Py_ssize_t ...@@ -89,6 +90,7 @@ static int __Pyx_PyUnicodeBufferContainsUCS4_BMP(Py_UNICODE* buffer, Py_ssize_t
} }
return 0; return 0;
} }
#endif
static CYTHON_INLINE int __Pyx_UnicodeContainsUCS4(PyObject* unicode, Py_UCS4 character) { static CYTHON_INLINE int __Pyx_UnicodeContainsUCS4(PyObject* unicode, Py_UCS4 character) {
#if CYTHON_PEP393_ENABLED #if CYTHON_PEP393_ENABLED
...@@ -102,7 +104,10 @@ static CYTHON_INLINE int __Pyx_UnicodeContainsUCS4(PyObject* unicode, Py_UCS4 ch ...@@ -102,7 +104,10 @@ static CYTHON_INLINE int __Pyx_UnicodeContainsUCS4(PyObject* unicode, Py_UCS4 ch
} }
return 0; return 0;
} }
#elif PY_VERSION_HEX >= 0x03090000
#error Cannot use "UChar in Unicode" in Python 3.9 without PEP-393 unicode strings.
#endif #endif
#if PY_VERSION_HEX < 0x03090000
#if Py_UNICODE_SIZE == 2 #if Py_UNICODE_SIZE == 2
if (unlikely(character > 65535)) { if (unlikely(character > 65535)) {
return __Pyx_PyUnicodeBufferContainsUCS4_SP( return __Pyx_PyUnicodeBufferContainsUCS4_SP(
...@@ -118,6 +123,7 @@ static CYTHON_INLINE int __Pyx_UnicodeContainsUCS4(PyObject* unicode, Py_UCS4 ch ...@@ -118,6 +123,7 @@ static CYTHON_INLINE int __Pyx_UnicodeContainsUCS4(PyObject* unicode, Py_UCS4 ch
character); character);
} }
#endif
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment