Skip to content

Commit

Permalink
Fix PyUnicode_GetSize(): Don't replace _PyUnicode_Ready() exception
Browse files Browse the repository at this point in the history
  • Loading branch information
vstinner committed Jun 16, 2012
1 parent 8a8b3ea commit 0762133
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 0762133

Please sign in to comment.