mirror of
https://github.com/python/cpython.git
synced 2025-07-15 07:15:18 +00:00
Allow string and unicode return types from .encode()/.decode()
methods on string and unicode objects. Added unicode.decode() which was missing for no apparent reason.
This commit is contained in:
parent
302fa6dc0d
commit
d2d4598ec2
3 changed files with 130 additions and 7 deletions
|
@ -141,6 +141,7 @@ typedef PY_UNICODE_TYPE Py_UNICODE;
|
|||
|
||||
# define PyUnicode_AsASCIIString PyUnicodeUCS2_AsASCIIString
|
||||
# define PyUnicode_AsCharmapString PyUnicodeUCS2_AsCharmapString
|
||||
# define PyUnicode_AsEncodedObject PyUnicodeUCS2_AsEncodedObject
|
||||
# define PyUnicode_AsEncodedString PyUnicodeUCS2_AsEncodedString
|
||||
# define PyUnicode_AsLatin1String PyUnicodeUCS2_AsLatin1String
|
||||
# define PyUnicode_AsRawUnicodeEscapeString PyUnicodeUCS2_AsRawUnicodeEscapeString
|
||||
|
@ -215,6 +216,7 @@ typedef PY_UNICODE_TYPE Py_UNICODE;
|
|||
|
||||
# define PyUnicode_AsASCIIString PyUnicodeUCS4_AsASCIIString
|
||||
# define PyUnicode_AsCharmapString PyUnicodeUCS4_AsCharmapString
|
||||
# define PyUnicode_AsEncodedObject PyUnicodeUCS4_AsEncodedObject
|
||||
# define PyUnicode_AsEncodedString PyUnicodeUCS4_AsEncodedString
|
||||
# define PyUnicode_AsLatin1String PyUnicodeUCS4_AsLatin1String
|
||||
# define PyUnicode_AsRawUnicodeEscapeString PyUnicodeUCS4_AsRawUnicodeEscapeString
|
||||
|
@ -626,6 +628,15 @@ PyAPI_FUNC(PyObject*) PyUnicode_Encode(
|
|||
const char *errors /* error handling */
|
||||
);
|
||||
|
||||
/* Encodes a Unicode object and returns the result as Python
|
||||
object. */
|
||||
|
||||
PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedObject(
|
||||
PyObject *unicode, /* Unicode object */
|
||||
const char *encoding, /* encoding */
|
||||
const char *errors /* error handling */
|
||||
);
|
||||
|
||||
/* Encodes a Unicode object and returns the result as Python string
|
||||
object. */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue