[Python-checkins] cpython: Make PyUnicode_Copy() private => _PyUnicode_Copy()

victor.stinner python-checkins at python.org
Mon Dec 12 01:51:31 CET 2011


http://hg.python.org/cpython/rev/9c76bb654809
changeset: 73942:9c76bb654809
user: Victor Stinner <victor.stinner at haypocalc.com>
date: Mon Dec 12 01:53:47 2011 +0100
summary:
 Make PyUnicode_Copy() private => _PyUnicode_Copy()
Undocument the function.
Make also decode_utf8_errors() as private (static).
files:
 Doc/c-api/unicode.rst | 7 -------
 Doc/whatsnew/3.3.rst | 4 ++--
 Include/unicodeobject.h | 4 +++-
 Objects/codeobject.c | 2 +-
 Objects/unicodeobject.c | 12 ++++++------
 5 files changed, 12 insertions(+), 17 deletions(-)
diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst
--- a/Doc/c-api/unicode.rst
+++ b/Doc/c-api/unicode.rst
@@ -386,13 +386,6 @@
 .. versionadded:: 3.3
 
 
-.. c:function:: PyObject* PyUnicode_Copy(PyObject *unicode)
-
- Get a new copy of a Unicode object.
-
- .. versionadded:: 3.3
-
-
 .. c:function:: PyObject* PyUnicode_FromKindAndData(int kind, const void *buffer, \
 Py_ssize_t size)
 
diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst
--- a/Doc/whatsnew/3.3.rst
+++ b/Doc/whatsnew/3.3.rst
@@ -769,8 +769,8 @@
 * :c:macro:`PyUnicode_GET_DATA_SIZE`: use
 ``PyUnicode_GET_LENGTH(str) * PyUnicode_KIND(str)`` (only work on ready
 strings)
- * :c:func:`PyUnicode_AsUnicodeCopy`: use :c:func:`PyUnicode_AsUCS4Copy`,
- :c:func:`PyUnicode_AsWideCharString` or :c:func:`PyUnicode_Copy`
+ * :c:func:`PyUnicode_AsUnicodeCopy`: use :c:func:`PyUnicode_AsUCS4Copy` or
+ :c:func:`PyUnicode_AsWideCharString`
 
 Functions and macros manipulating Py_UNICODE* strings:
 
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -616,9 +616,11 @@
 #endif
 
 /* Get a copy of a Unicode string. */
-PyAPI_FUNC(PyObject*) PyUnicode_Copy(
+#ifndef Py_LIMITED_API
+PyAPI_FUNC(PyObject*) _PyUnicode_Copy(
 PyObject *unicode
 );
+#endif
 
 /* Copy character from one unicode object into another, this function performs
 character conversion when necessary and falls back to memcpy if possible.
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -249,7 +249,7 @@
 return NULL;
 }
 else {
- item = PyUnicode_Copy(item);
+ item = _PyUnicode_Copy(item);
 if (item == NULL) {
 Py_DECREF(newtuple);
 return NULL;
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -497,7 +497,7 @@
 }
 else
 /* Subtype -- return genuine unicode string with the same value. */
- return PyUnicode_Copy(unicode);
+ return _PyUnicode_Copy(unicode);
 }
 
 #ifdef HAVE_MBCS
@@ -1961,7 +1961,7 @@
 }
 
 PyObject*
-PyUnicode_Copy(PyObject *unicode)
+_PyUnicode_Copy(PyObject *unicode)
 {
 Py_ssize_t length;
 PyObject *copy;
@@ -2832,7 +2832,7 @@
 if (PyUnicode_Check(obj)) {
 /* For a Unicode subtype that's not a Unicode object,
 return a true Unicode object with the same data. */
- return PyUnicode_Copy(obj);
+ return _PyUnicode_Copy(obj);
 }
 PyErr_Format(PyExc_TypeError,
 "Can't convert '%.100s' object to str implicitly",
@@ -4333,7 +4333,7 @@
 goto onError; \
 } while (0)
 
-PyObject *
+static PyObject *
 decode_utf8_errors(const char *starts,
 Py_ssize_t size,
 const char *errors,
@@ -9231,7 +9231,7 @@
 Py_UCS4 maxchar_old, maxchar_new = 0;
 PyObject *v;
 
- u = PyUnicode_Copy(self);
+ u = _PyUnicode_Copy(self);
 if (u == NULL)
 return NULL;
 maxchar_old = PyUnicode_MAX_CHAR_VALUE(u);
@@ -12753,7 +12753,7 @@
 static PyObject *
 unicode_getnewargs(PyObject *v)
 {
- PyObject *copy = PyUnicode_Copy(v);
+ PyObject *copy = _PyUnicode_Copy(v);
 if (!copy)
 return NULL;
 return Py_BuildValue("(N)", copy);
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /