Commit 921fd3d9 authored by Stefan Behnel's avatar Stefan Behnel

Avoid useless C-API call to get a constant.

parent 2697cdb0
......@@ -595,6 +595,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Substring(
PyObject* text, Py_ssize_t start, Py_ssize_t stop);
/////////////// PyUnicode_Substring ///////////////
//@substitute: naming
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Substring(
PyObject* text, Py_ssize_t start, Py_ssize_t stop) {
......@@ -611,7 +612,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_Substring(
else if (stop > length)
stop = length;
if (stop <= start)
return PyUnicode_FromUnicode(NULL, 0);
return __Pyx_NewRef($empty_unicode);
#if CYTHON_PEP393_ENABLED
return PyUnicode_FromKindAndData(PyUnicode_KIND(text),
PyUnicode_1BYTE_DATA(text) + start*PyUnicode_KIND(text), stop-start);
......
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