Commit 109ab9a8 authored by Stefan Behnel's avatar Stefan Behnel

raise overflow error in Py3.3+ when non-BMP Unicode characters are coerced...

raise overflow error in Py3.3+ when non-BMP Unicode characters are coerced into a short Py_UNICODE value

--HG--
extra : transplant_source : %D3%96%7C%F9%3F%AE%1AA%8C%B9%0E%918%FB%27%F4%CB%E7u-
parent 3b67ea4b
...@@ -188,6 +188,10 @@ Features added ...@@ -188,6 +188,10 @@ Features added
Bugs fixed Bugs fixed
---------- ----------
* In CPython 3.3, converting a Unicode character to the Py_UNICODE type
could fail to raise an overflow for non-BMP characters that do not fit
into a wchar_t on the current platform.
Other changes Other changes
------------- -------------
......
...@@ -94,8 +94,12 @@ static CYTHON_INLINE Py_UNICODE __Pyx_PyObject_AsPy_UNICODE(PyObject*); ...@@ -94,8 +94,12 @@ static CYTHON_INLINE Py_UNICODE __Pyx_PyObject_AsPy_UNICODE(PyObject*);
static CYTHON_INLINE Py_UNICODE __Pyx_PyObject_AsPy_UNICODE(PyObject* x) { static CYTHON_INLINE Py_UNICODE __Pyx_PyObject_AsPy_UNICODE(PyObject* x) {
long ival; long ival;
#if CYTHON_PEP393_ENABLED #if CYTHON_PEP393_ENABLED
#if Py_UNICODE_SIZE > 2
const long maxval = 1114111; const long maxval = 1114111;
#else #else
const long maxval = 65535;
#endif
#else
static long maxval = 0; static long maxval = 0;
#endif #endif
if (PyUnicode_Check(x)) { if (PyUnicode_Check(x)) {
......
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