mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
Added new API PyUnicode_FromEncodedObject() which supports decoding
objects including instance objects. The old API PyUnicode_FromObject() is still available as shortcut.
This commit is contained in:
parent
b6d78fcd9c
commit
5a5c81a0e9
2 changed files with 67 additions and 6 deletions
|
@ -297,6 +297,24 @@ extern DL_IMPORT(int) PyUnicode_Resize(
|
|||
|
||||
*/
|
||||
|
||||
extern DL_IMPORT(PyObject*) PyUnicode_FromEncodedObject(
|
||||
register PyObject *obj, /* Object */
|
||||
const char *encoding, /* encoding */
|
||||
const char *errors /* error handling */
|
||||
);
|
||||
|
||||
/* Shortcut for PyUnicode_FromEncodedObject(obj, NULL, "strict");
|
||||
which results in using the default encoding as basis for
|
||||
decoding the object.
|
||||
|
||||
Coerces obj to an Unicode object and return a reference with
|
||||
*incremented* refcount.
|
||||
|
||||
The API returns NULL in case of an error. The caller is responsible
|
||||
for decref'ing the returned objects.
|
||||
|
||||
*/
|
||||
|
||||
extern DL_IMPORT(PyObject*) PyUnicode_FromObject(
|
||||
register PyObject *obj /* Object */
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue