summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2012-06-16 02:53:46 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2012-06-16 02:53:46 (GMT)
commit07621338fb29444a7b2038da44f3cb57a328a7ce (patch)
treec5560f0f5d21721475259736a5439b5592db37fa /Objects/unicodeobject.c
parent8a8b3eaabe0a3cf2f4df1b23239dde33d5dd10c4 (diff)
downloadcpython-07621338fb29444a7b2038da44f3cb57a328a7ce.zip
cpython-07621338fb29444a7b2038da44f3cb57a328a7ce.tar.gz
cpython-07621338fb29444a7b2038da44f3cb57a328a7ce.tar.bz2
Fix PyUnicode_GetSize(): Don't replace _PyUnicode_Ready() exception
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index cf9aec2..267dae1 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -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);
}