[Python-checkins] cpython: Replace PyUnicode_FromUnicode(NULL, 0) by PyUnicode_New(0, 0)

victor.stinner python-checkins at python.org
Thu Dec 1 03:16:38 CET 2011


http://hg.python.org/cpython/rev/d855329d0f72
changeset:   73803:d855329d0f72
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Thu Dec 01 03:18:59 2011 +0100
summary:
  Replace PyUnicode_FromUnicode(NULL, 0) by PyUnicode_New(0, 0)

Create an empty string with the new Unicode API.

files:
  Modules/cjkcodecs/multibytecodec.c |  4 ++--
  Objects/stringlib/unicode_format.h |  2 +-
  2 files changed, 3 insertions(+), 3 deletions(-)


diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c
--- a/Modules/cjkcodecs/multibytecodec.c
+++ b/Modules/cjkcodecs/multibytecodec.c
@@ -633,7 +633,7 @@
     if (datalen == 0) {
         PyBuffer_Release(&pdata);
         ERROR_DECREF(errorcb);
-        return make_tuple(PyUnicode_FromUnicode(NULL, 0), 0);
+        return make_tuple(PyUnicode_New(0, 0), 0);
     }
 
     buf.excobj = NULL;
@@ -1265,7 +1265,7 @@
     Py_ssize_t rsize, finalsize = 0;
 
     if (sizehint == 0)
-        return PyUnicode_FromUnicode(NULL, 0);
+        return PyUnicode_New(0, 0);
 
     buf.outobj = buf.excobj = NULL;
     cres = NULL;
diff --git a/Objects/stringlib/unicode_format.h b/Objects/stringlib/unicode_format.h
--- a/Objects/stringlib/unicode_format.h
+++ b/Objects/stringlib/unicode_format.h
@@ -79,7 +79,7 @@
 SubString_new_object_or_empty(SubString *str)
 {
     if (str->str == NULL) {
-        return PyUnicode_FromUnicode(NULL, 0);
+        return PyUnicode_New(0, 0);
     }
     return SubString_new_object(str);
 }

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


More information about the Python-checkins mailing list