Skip to content

Commit 3a7f797

Browse files
committed
Remove buggy assertion in PyUnicode_Substring()
Use also directly unicode_empty, instead of PyUnicode_New(0,0).
1 parent 684d5fd commit 3a7f797

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Objects/unicodeobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12078,8 +12078,8 @@ PyUnicode_Substring(PyObject *self, Py_ssize_t start, Py_ssize_t end)
1207812078
return NULL;
1207912079
}
1208012080
if (start >= length || end < start) {
12081-
assert(end == length);
12082-
return PyUnicode_New(0, 0);
12081+
Py_INCREF(unicode_empty);
12082+
return unicode_empty;
1208312083
}
1208412084

1208512085
length = end - start;

0 commit comments

Comments
 (0)