diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2020-07-05 21:00:19 +0200 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2020-07-05 21:01:21 +0200 |
commit | 336363893b6cc02f6c1d0f26102ea2501784f7d7 (patch) | |
tree | 95db6710453dcb1d950910b7081eba331a91a361 | |
parent | ccd17d5331876b9f9a0b7ad47ca7e6eee738cce2 (diff) | |
download | cython-336363893b6cc02f6c1d0f26102ea2501784f7d7.tar.gz |
Disable Py_UNICODE fallback for __Pyx_UnicodeContainsUCS4() in Py3.9 since Py_UNICODE is deprecated and PEP-393 unicode is practically required.
-rw-r--r-- | Cython/Utility/StringTools.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Cython/Utility/StringTools.c b/Cython/Utility/StringTools.c index 222edd8fc..feb6c99df 100644 --- a/Cython/Utility/StringTools.c +++ b/Cython/Utility/StringTools.c @@ -118,6 +118,7 @@ static CYTHON_INLINE int __Pyx_UnicodeContainsUCS4(PyObject* unicode, Py_UCS4 ch //////////////////// PyUCS4InUnicode //////////////////// +#if PY_VERSION_HEX < 0x03090000 #if Py_UNICODE_SIZE == 2 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 */ @@ -141,6 +142,7 @@ static int __Pyx_PyUnicodeBufferContainsUCS4_BMP(Py_UNICODE* buffer, Py_ssize_t } return 0; } +#endif static CYTHON_INLINE int __Pyx_UnicodeContainsUCS4(PyObject* unicode, Py_UCS4 character) { #if CYTHON_PEP393_ENABLED @@ -154,7 +156,10 @@ static CYTHON_INLINE int __Pyx_UnicodeContainsUCS4(PyObject* unicode, Py_UCS4 ch } return 0; } +#elif PY_VERSION_HEX >= 0x03090000 + #error Cannot use "UChar in Unicode" in Python 3.9 without PEP-393 unicode strings. #endif +#if PY_VERSION_HEX < 0x03090000 #if Py_UNICODE_SIZE == 2 if (unlikely(character > 65535)) { return __Pyx_PyUnicodeBufferContainsUCS4_SP( @@ -170,6 +175,7 @@ static CYTHON_INLINE int __Pyx_UnicodeContainsUCS4(PyObject* unicode, Py_UCS4 ch character); } +#endif } |