Skip to content
Snippets Groups Projects
Commit c7f93cd459cf authored by Stefan Behnel's avatar Stefan Behnel
Browse files

Avoid calling PyUnicode_FromUnicode() in Py3.

parent eb9fdb5d8156
No related branches found
No related tags found
No related merge requests found
......@@ -443,6 +443,7 @@
/////////////// decode_c_string ///////////////
//@requires: IncludeStringH
//@requires: decode_c_string_utf16
//@substitute: naming
/* duplicate code to avoid calling strlen() if start >= 0 and stop >= 0 */
static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
......@@ -467,7 +468,7 @@
stop += length;
}
if (unlikely(stop <= start))
return PyUnicode_FromUnicode(NULL, 0);
return __Pyx_NewRef($empty_unicode);
length = stop - start;
cstring += start;
if (decode_func) {
......@@ -486,6 +487,7 @@
/////////////// decode_c_bytes ///////////////
//@requires: decode_c_string_utf16
//@substitute: naming
static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop,
......@@ -503,7 +505,7 @@
if (stop > length)
stop = length;
if (unlikely(stop <= start))
return PyUnicode_FromUnicode(NULL, 0);
return __Pyx_NewRef($empty_unicode);
length = stop - start;
cstring += start;
if (decode_func) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment