mirror of
https://github.com/python/cpython.git
synced 2025-08-01 15:43:13 +00:00
Backport of several functions from Python 3.0 to 2.6 including PyUnicode_FromString, PyUnicode_Format and PyLong_From/AsSsize_t. The functions are partly required for the backport of the bytearray type and _fileio module. They should also make it easier to port C to 3.0.
First chapter of the Python 3.0 io framework back port: _fileio The next step depends on a working bytearray type which itself depends on a backport of the nwe buffer API.
This commit is contained in:
parent
5f95a79b2b
commit
7f39c9fcbb
8 changed files with 1599 additions and 173 deletions
|
@ -183,6 +183,10 @@ typedef PY_UNICODE_TYPE Py_UNICODE;
|
|||
# define PyUnicode_FromObject PyUnicodeUCS2_FromObject
|
||||
# define PyUnicode_FromOrdinal PyUnicodeUCS2_FromOrdinal
|
||||
# define PyUnicode_FromUnicode PyUnicodeUCS2_FromUnicode
|
||||
# define PyUnicode_FromString PyUnicodeUCS2_FromString
|
||||
# define PyUnicode_FromStringAndSize PyUnicodeUCS2_FromStringAndSize
|
||||
# define PyUnicode_FromFormatV PyUnicodeUCS2_FromFormatV
|
||||
# define PyUnicode_FromFormat PyUnicodeUCS2_FromFormat
|
||||
# define PyUnicode_FromWideChar PyUnicodeUCS2_FromWideChar
|
||||
# define PyUnicode_GetDefaultEncoding PyUnicodeUCS2_GetDefaultEncoding
|
||||
# define PyUnicode_GetMax PyUnicodeUCS2_GetMax
|
||||
|
@ -265,6 +269,10 @@ typedef PY_UNICODE_TYPE Py_UNICODE;
|
|||
# define PyUnicode_FromObject PyUnicodeUCS4_FromObject
|
||||
# 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
|
||||
|
@ -442,6 +450,18 @@ 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(
|
||||
const char *u /* string */
|
||||
);
|
||||
|
||||
/* Return a read-only pointer to the Unicode object's internal
|
||||
Py_UNICODE buffer. */
|
||||
|
||||
|
@ -517,6 +537,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue