[Python-checkins] cpython: don't ready in case_operation, since most callers do it themselves

benjamin.peterson python-checkins at python.org
Mon Jan 16 20:28:55 CET 2012


http://hg.python.org/cpython/rev/c3972c4d7edb
changeset:   74453:c3972c4d7edb
user:        Benjamin Peterson <benjamin at python.org>
date:        Mon Jan 16 14:28:50 2012 -0500
summary:
  don't ready in case_operation, since most callers do it themselves

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


diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -9644,8 +9644,7 @@
     void *data, *outdata;
     Py_UCS4 maxchar = 0, *tmp, *tmpend;
 
-    if (PyUnicode_READY(self) == -1)
-        return NULL;
+    assert(PyUnicode_IS_READY(self));
 
     kind = PyUnicode_KIND(self);
     data = PyUnicode_DATA(self);
@@ -10512,6 +10511,8 @@
 static PyObject*
 unicode_title(PyObject *self)
 {
+    if (PyUnicode_READY(self) == -1)
+        return NULL;
     return case_operation(self, do_title);
 }
 
@@ -12657,6 +12658,8 @@
 static PyObject*
 unicode_swapcase(PyObject *self)
 {
+    if (PyUnicode_READY(self) == -1)
+        return NULL;
     return case_operation(self, do_swapcase);
 }
 

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


More information about the Python-checkins mailing list