Commit bf6e560d authored by Victor Stinner's avatar Victor Stinner

Make PyUnicode_Copy() private => _PyUnicode_Copy()

Undocument the function.

Make also decode_utf8_errors() as private (static).
parent 7a9105a3
...@@ -386,13 +386,6 @@ APIs: ...@@ -386,13 +386,6 @@ APIs:
.. versionadded:: 3.3 .. 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, \ .. c:function:: PyObject* PyUnicode_FromKindAndData(int kind, const void *buffer, \
Py_ssize_t size) Py_ssize_t size)
......
...@@ -769,8 +769,8 @@ Unicode functions and methods using :c:type:`Py_UNICODE` and ...@@ -769,8 +769,8 @@ Unicode functions and methods using :c:type:`Py_UNICODE` and
* :c:macro:`PyUnicode_GET_DATA_SIZE`: use * :c:macro:`PyUnicode_GET_DATA_SIZE`: use
``PyUnicode_GET_LENGTH(str) * PyUnicode_KIND(str)`` (only work on ready ``PyUnicode_GET_LENGTH(str) * PyUnicode_KIND(str)`` (only work on ready
strings) strings)
* :c:func:`PyUnicode_AsUnicodeCopy`: use :c:func:`PyUnicode_AsUCS4Copy`, * :c:func:`PyUnicode_AsUnicodeCopy`: use :c:func:`PyUnicode_AsUCS4Copy` or
:c:func:`PyUnicode_AsWideCharString` or :c:func:`PyUnicode_Copy` :c:func:`PyUnicode_AsWideCharString`
Functions and macros manipulating Py_UNICODE* strings: Functions and macros manipulating Py_UNICODE* strings:
......
...@@ -616,9 +616,11 @@ PyAPI_FUNC(int) _PyUnicode_Ready( ...@@ -616,9 +616,11 @@ PyAPI_FUNC(int) _PyUnicode_Ready(
#endif #endif
/* Get a copy of a Unicode string. */ /* Get a copy of a Unicode string. */
PyAPI_FUNC(PyObject*) PyUnicode_Copy( #ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject*) _PyUnicode_Copy(
PyObject *unicode PyObject *unicode
); );
#endif
/* Copy character from one unicode object into another, this function performs /* Copy character from one unicode object into another, this function performs
character conversion when necessary and falls back to memcpy if possible. character conversion when necessary and falls back to memcpy if possible.
......
...@@ -249,7 +249,7 @@ validate_and_copy_tuple(PyObject *tup) ...@@ -249,7 +249,7 @@ validate_and_copy_tuple(PyObject *tup)
return NULL; return NULL;
} }
else { else {
item = PyUnicode_Copy(item); item = _PyUnicode_Copy(item);
if (item == NULL) { if (item == NULL) {
Py_DECREF(newtuple); Py_DECREF(newtuple);
return NULL; return NULL;
......
...@@ -497,7 +497,7 @@ unicode_result_unchanged(PyObject *unicode) ...@@ -497,7 +497,7 @@ unicode_result_unchanged(PyObject *unicode)
} }
else else
/* Subtype -- return genuine unicode string with the same value. */ /* Subtype -- return genuine unicode string with the same value. */
return PyUnicode_Copy(unicode); return _PyUnicode_Copy(unicode);
} }
#ifdef HAVE_MBCS #ifdef HAVE_MBCS
...@@ -1961,7 +1961,7 @@ unicode_adjust_maxchar(PyObject **p_unicode) ...@@ -1961,7 +1961,7 @@ unicode_adjust_maxchar(PyObject **p_unicode)
} }
PyObject* PyObject*
PyUnicode_Copy(PyObject *unicode) _PyUnicode_Copy(PyObject *unicode)
{ {
Py_ssize_t length; Py_ssize_t length;
PyObject *copy; PyObject *copy;
...@@ -2832,7 +2832,7 @@ PyUnicode_FromObject(register PyObject *obj) ...@@ -2832,7 +2832,7 @@ PyUnicode_FromObject(register PyObject *obj)
if (PyUnicode_Check(obj)) { if (PyUnicode_Check(obj)) {
/* For a Unicode subtype that's not a Unicode object, /* For a Unicode subtype that's not a Unicode object,
return a true Unicode object with the same data. */ return a true Unicode object with the same data. */
return PyUnicode_Copy(obj); return _PyUnicode_Copy(obj);
} }
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
"Can't convert '%.100s' object to str implicitly", "Can't convert '%.100s' object to str implicitly",
...@@ -4333,7 +4333,7 @@ _ucs4loop: ...@@ -4333,7 +4333,7 @@ _ucs4loop:
goto onError; \ goto onError; \
} while (0) } while (0)
PyObject * static PyObject *
decode_utf8_errors(const char *starts, decode_utf8_errors(const char *starts,
Py_ssize_t size, Py_ssize_t size,
const char *errors, const char *errors,
...@@ -9231,7 +9231,7 @@ fixup(PyObject *self, ...@@ -9231,7 +9231,7 @@ fixup(PyObject *self,
Py_UCS4 maxchar_old, maxchar_new = 0; Py_UCS4 maxchar_old, maxchar_new = 0;
PyObject *v; PyObject *v;
u = PyUnicode_Copy(self); u = _PyUnicode_Copy(self);
if (u == NULL) if (u == NULL)
return NULL; return NULL;
maxchar_old = PyUnicode_MAX_CHAR_VALUE(u); maxchar_old = PyUnicode_MAX_CHAR_VALUE(u);
...@@ -12753,7 +12753,7 @@ PyDoc_STRVAR(sizeof__doc__, ...@@ -12753,7 +12753,7 @@ PyDoc_STRVAR(sizeof__doc__,
static PyObject * static PyObject *
unicode_getnewargs(PyObject *v) unicode_getnewargs(PyObject *v)
{ {
PyObject *copy = PyUnicode_Copy(v); PyObject *copy = _PyUnicode_Copy(v);
if (!copy) if (!copy)
return NULL; return NULL;
return Py_BuildValue("(N)", copy); return Py_BuildValue("(N)", copy);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment