Commit b1536150 authored by Victor Stinner's avatar Victor Stinner

PyUnicode_CopyCharacters() uses exceptions instead of assertions

Call PyErr_BadInternalCall() if inputs are not unicode strings.
parent 1fe99a2e
......@@ -626,8 +626,10 @@ PyUnicode_CopyCharacters(PyObject *to, Py_ssize_t to_start,
unsigned int from_kind, to_kind;
void *from_data, *to_data;
assert(PyUnicode_Check(from));
assert(PyUnicode_Check(to));
if (!PyUnicode_Check(from) || !PyUnicode_Check(to)) {
PyErr_BadInternalCall();
return -1;
}
if (PyUnicode_READY(from))
return -1;
......
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