Fix PyUnicode_GetSize(): Don't replace _PyUnicode_Ready() exception

This commit is contained in:
Victor Stinner 2012-06-16 04:53:46 +02:00
parent 8a8b3eaabe
commit 07621338fb

View file

@ -3995,11 +3995,12 @@ PyUnicode_GetSize(PyObject *unicode)
Py_ssize_t
PyUnicode_GetLength(PyObject *unicode)
{
if (!PyUnicode_Check(unicode) || PyUnicode_READY(unicode) == -1) {
if (!PyUnicode_Check(unicode)) {
PyErr_BadArgument();
return -1;
}
if (PyUnicode_READY(unicode) == -1)
return -1;
return PyUnicode_GET_LENGTH(unicode);
}