gh-127903: Fix a crash on debug builds when calling Objects/unicodeobject::_copy_characters` (#127876)
This commit is contained in:
committed by
GitHub
parent
4c14f03495
commit
46cb6340d7
@@ -1463,11 +1463,14 @@ _copy_characters(PyObject *to, Py_ssize_t to_start,
|
||||
assert(PyUnicode_Check(from));
|
||||
assert(from_start + how_many <= PyUnicode_GET_LENGTH(from));
|
||||
|
||||
assert(PyUnicode_Check(to));
|
||||
assert(to_start + how_many <= PyUnicode_GET_LENGTH(to));
|
||||
assert(to == NULL || PyUnicode_Check(to));
|
||||
|
||||
if (how_many == 0)
|
||||
if (how_many == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
assert(to != NULL);
|
||||
assert(to_start + how_many <= PyUnicode_GET_LENGTH(to));
|
||||
|
||||
from_kind = PyUnicode_KIND(from);
|
||||
from_data = PyUnicode_DATA(from);
|
||||
|
||||
Reference in New Issue
Block a user