[Python-checkins] cpython: Fix PyUnicode_GetSize(): Don't replace _PyUnicode_Ready() exception

victor.stinner python-checkins at python.org
Sat Jun 16 04:56:16 CEST 2012


http://hg.python.org/cpython/rev/176e61901895
changeset:   77467:176e61901895
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Sat Jun 16 04:53:46 2012 +0200
summary:
  Fix PyUnicode_GetSize(): Don't replace _PyUnicode_Ready() exception

files:
  Objects/unicodeobject.c |  5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)


diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -3995,11 +3995,12 @@
 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);
 }
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list