summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2020-04-20 09:31:48 +0200
committerStefan Behnel <stefan_ml@behnel.de>2020-04-20 09:31:48 +0200
commit921fd3d9f2f3fadeaedfe491c48741c6e7aa2a3d (patch)
treee609e11c0d02e6fab2ee74ef7d6968151d467dc3
parent2697cdb069add4c143b2d366a86a92c1d29b8d3b (diff)
downloadcython-921fd3d9f2f3fadeaedfe491c48741c6e7aa2a3d.tar.gz
Avoid useless C-API call to get a constant.
-rw-r--r--Cython/Utility/StringTools.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Cython/Utility/StringTools.c b/Cython/Utility/StringTools.c
index 4f6009eca..bd9271117 100644
--- a/Cython/Utility/StringTools.c
+++ b/Cython/Utility/StringTools.c
@@ -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);