Commit d5a53300 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
parent 97c61435
...@@ -11,6 +11,10 @@ Features added ...@@ -11,6 +11,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
------------- -------------
......
...@@ -209,8 +209,12 @@ static CYTHON_INLINE Py_UNICODE __Pyx_PyObject_AsPy_UNICODE(PyObject*); ...@@ -209,8 +209,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