]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Remove buggy assertion in PyUnicode_Substring()
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 3 May 2012 01:36:40 +0000 (03:36 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Thu, 3 May 2012 01:36:40 +0000 (03:36 +0200)
Use also directly unicode_empty, instead of PyUnicode_New(0,0).

Objects/unicodeobject.c

index 09b57338a0d266eefd39776376ea038d35af1b8c..0e7493bb61492f21cc4467734df083f956718552 100644 (file)
@@ -12078,8 +12078,8 @@ PyUnicode_Substring(PyObject *self, Py_ssize_t start, Py_ssize_t end)
         return NULL;
     }
     if (start >= length || end < start) {
-        assert(end == length);
-        return PyUnicode_New(0, 0);
+        Py_INCREF(unicode_empty);
+        return unicode_empty;
     }
 
     length = end - start;