diff options
author | Walter Dörwald <walter@livinglogic.de> | 2007-05-18 16:29:38 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2007-05-18 16:29:38 (GMT) |
commit | d2034310d66b9d387b252972852537c0b592f141 (patch) | |
tree | 77d03818fd4896b2dc1ea3eb87202bf1d82d8866 /Include/unicodeobject.h | |
parent | 5550731d9cf5bca2379b15d5238ee5a39ebc6ce3 (diff) | |
download | cpython-d2034310d66b9d387b252972852537c0b592f141.zip cpython-d2034310d66b9d387b252972852537c0b592f141.tar.gz cpython-d2034310d66b9d387b252972852537c0b592f141.tar.bz2 |
Add 'U'/'U#' format characters to Py_BuildValue (and thus
to PyObject_CallFunction()) that take a char * (and a size
in the case of 'U#') and create a unicode object out of it.
Add functions PyUnicode_FromFormat() and PyUnicode_FromFormatV()
that work similar to PyString_FromFormat(), but create a unicode
object (also a %U format character has been added, that takes
a PyObject *, which must point to a unicode object).
Change the encoding and reason attributes of UnicodeEncodeError,
UnicodeDecodeError and UnicodeTranslateError to be unicode
objects.
Diffstat (limited to 'Include/unicodeobject.h')
-rw-r--r-- | Include/unicodeobject.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h index 9d0cabf..2e27d74 100644 --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -173,7 +173,9 @@ typedef PY_UNICODE_TYPE Py_UNICODE; # define PyUnicode_FromOrdinal PyUnicodeUCS2_FromOrdinal # define PyUnicode_FromUnicode PyUnicodeUCS2_FromUnicode # define PyUnicode_FromString PyUnicodeUCS2_FromString -# define PyUnicode_FromWideChar PyUnicodeUCS2_FromWideChar +# define PyUnicode_FromStringAndSize PyUnicodeUCS2_FromStringAndSize +# define PyUnicode_FromFormatV PyUnicodeUCS2_FromFormatV +# define PyUnicode_FromFormat PyUnicodeUCS2_FromFormat # define PyUnicode_GetDefaultEncoding PyUnicodeUCS2_GetDefaultEncoding # define PyUnicode_GetMax PyUnicodeUCS2_GetMax # define PyUnicode_GetSize PyUnicodeUCS2_GetSize @@ -252,6 +254,9 @@ typedef PY_UNICODE_TYPE Py_UNICODE; # define PyUnicode_FromOrdinal PyUnicodeUCS4_FromOrdinal # define PyUnicode_FromUnicode PyUnicodeUCS4_FromUnicode # define PyUnicode_FromString PyUnicodeUCS4_FromString +# define PyUnicode_FromStringAndSize PyUnicodeUCS4_FromStringAndSize +# define PyUnicode_FromFormatV PyUnicodeUCS4_FromFormatV +# define PyUnicode_FromFormat PyUnicodeUCS4_FromFormat # define PyUnicode_FromWideChar PyUnicodeUCS4_FromWideChar # define PyUnicode_GetDefaultEncoding PyUnicodeUCS4_GetDefaultEncoding # define PyUnicode_GetMax PyUnicodeUCS4_GetMax @@ -429,6 +434,12 @@ PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode( Py_ssize_t size /* size of buffer */ ); +/* Similar to PyUnicode_FromUnicode(), but u points to Latin-1 encoded bytes */ +PyAPI_FUNC(PyObject*) PyUnicode_FromStringAndSize( + const char *u, /* char buffer */ + Py_ssize_t size /* size of buffer */ + ); + /* Similar to PyUnicode_FromUnicode(), but u points to null-terminated Latin-1 encoded bytes */ PyAPI_FUNC(PyObject*) PyUnicode_FromString( @@ -510,6 +521,9 @@ PyAPI_FUNC(PyObject*) PyUnicode_FromObject( register PyObject *obj /* Object */ ); +PyAPI_FUNC(PyObject *) PyUnicode_FromFormatV(const char*, va_list); +PyAPI_FUNC(PyObject *) PyUnicode_FromFormat(const char*, ...); + /* --- wchar_t support for platforms which support it --------------------- */ #ifdef HAVE_WCHAR_H |