Commits

Victor Stinner  committed 176e619

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

  • Participants
  • Parent commits 34a6a23

Comments (0)

Files changed (1)

File Objects/unicodeobject.c

 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);
 }