mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-111089: Revert PyUnicode_AsUTF8() changes (#111833)
* Revert "gh-111089: Use PyUnicode_AsUTF8() in Argument Clinic (#111585)" This reverts commitd9b606b3d0
. * Revert "gh-111089: Use PyUnicode_AsUTF8() in getargs.c (#111620)" This reverts commitcde1071b2a
. * Revert "gh-111089: PyUnicode_AsUTF8() now raises on embedded NUL (#111091)" This reverts commitd731579bfb
. * Revert "gh-111089: Add PyUnicode_AsUTF8() to the limited C API (#111121)" This reverts commitd8f32be5b6
. * Revert "gh-111089: Use PyUnicode_AsUTF8() in sqlite3 (#111122)" This reverts commit37e4e20eaa
.
This commit is contained in:
parent
ea970fb116
commit
11e83488c5
50 changed files with 951 additions and 243 deletions
|
@ -440,6 +440,22 @@ PyAPI_FUNC(PyObject*) PyUnicode_FromKindAndData(
|
|||
const void *buffer,
|
||||
Py_ssize_t size);
|
||||
|
||||
/* --- Manage the default encoding ---------------------------------------- */
|
||||
|
||||
/* Returns a pointer to the default encoding (UTF-8) of the
|
||||
Unicode object unicode.
|
||||
|
||||
Like PyUnicode_AsUTF8AndSize(), this also caches the UTF-8 representation
|
||||
in the unicodeobject.
|
||||
|
||||
_PyUnicode_AsString is a #define for PyUnicode_AsUTF8 to
|
||||
support the previous internal function with the same behaviour.
|
||||
|
||||
Use of this API is DEPRECATED since no size information can be
|
||||
extracted from the returned data.
|
||||
*/
|
||||
|
||||
PyAPI_FUNC(const char *) PyUnicode_AsUTF8(PyObject *unicode);
|
||||
|
||||
/* === Characters Type APIs =============================================== */
|
||||
|
||||
|
|
|
@ -443,25 +443,17 @@ PyAPI_FUNC(PyObject*) PyUnicode_AsUTF8String(
|
|||
PyObject *unicode /* Unicode object */
|
||||
);
|
||||
|
||||
// Returns a pointer to the UTF-8 encoding of the Unicode object unicode.
|
||||
//
|
||||
// Raise an exception if the string contains embedded null characters.
|
||||
// Use PyUnicode_AsUTF8AndSize() to accept embedded null characters.
|
||||
//
|
||||
// This function caches the UTF-8 encoded string in the Unicode object
|
||||
// and subsequent calls will return the same string. The memory is released
|
||||
// when the Unicode object is deallocated.
|
||||
PyAPI_FUNC(const char *) PyUnicode_AsUTF8(PyObject *unicode);
|
||||
/* Returns a pointer to the default encoding (UTF-8) of the
|
||||
Unicode object unicode and the size of the encoded representation
|
||||
in bytes stored in *size.
|
||||
|
||||
In case of an error, no *size is set.
|
||||
|
||||
This function caches the UTF-8 encoded string in the unicodeobject
|
||||
and subsequent calls will return the same string. The memory is released
|
||||
when the unicodeobject is deallocated.
|
||||
*/
|
||||
|
||||
// Returns a pointer to the UTF-8 encoding of the
|
||||
// Unicode object unicode and the size of the encoded representation
|
||||
// in bytes stored in `*size` (if size is not NULL).
|
||||
//
|
||||
// On error, `*size` is set to 0 (if size is not NULL).
|
||||
//
|
||||
// This function caches the UTF-8 encoded string in the Unicode object
|
||||
// and subsequent calls will return the same string. The memory is released
|
||||
// when the Unicode object is deallocated.
|
||||
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030A0000
|
||||
PyAPI_FUNC(const char *) PyUnicode_AsUTF8AndSize(
|
||||
PyObject *unicode,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue