#include "pyconfig.h"
#ifndef Py_GIL_DISABLED
#define Py_LIMITED_API …
#endif
#include "parts.h"
#include "util.h"
#include <stddef.h>
#include <string.h>
static PyObject *
codec_incrementalencoder(PyObject *self, PyObject *args)
{ … }
static PyObject *
codec_incrementaldecoder(PyObject *self, PyObject *args)
{ … }
static PyObject *
test_unicode_compare_with_ascii(PyObject *self, PyObject *Py_UNUSED(ignored))
{ … }
static PyObject *
test_widechar(PyObject *self, PyObject *Py_UNUSED(ignored))
{ … }
static PyObject *
unicode_copy(PyObject *unicode)
{ … }
static PyObject *
unicode_writechar(PyObject *self, PyObject *args)
{ … }
static void
unicode_fill(PyObject *str, Py_ssize_t start, Py_ssize_t end, Py_UCS4 ch)
{ … }
static PyObject *
unicode_resize(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_append(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_appendanddel(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_fromstringandsize(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_fromstring(PyObject *self, PyObject *arg)
{ … }
static PyObject *
unicode_substring(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_getlength(PyObject *self, PyObject *arg)
{ … }
static PyObject *
unicode_readchar(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_fromencodedobject(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_fromobject(PyObject *self, PyObject *arg)
{ … }
static PyObject *
unicode_interninplace(PyObject *self, PyObject *arg)
{ … }
static PyObject *
unicode_internfromstring(PyObject *self, PyObject *arg)
{ … }
static PyObject *
unicode_fromwidechar(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_aswidechar(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_aswidechar_null(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_aswidecharstring(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_aswidecharstring_null(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_fromordinal(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_asutf8andsize(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_asutf8andsize_null(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_getdefaultencoding(PyObject *self, PyObject *Py_UNUSED(ignored))
{ … }
static PyObject *
unicode_decode(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_asencodedstring(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_buildencodingmap(PyObject *self, PyObject *arg)
{ … }
static PyObject *
unicode_decodeutf7(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_decodeutf7stateful(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_decodeutf8(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_decodeutf8stateful(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_asutf8string(PyObject *self, PyObject *arg)
{ … }
static PyObject *
unicode_decodeutf32(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_decodeutf32stateful(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_asutf32string(PyObject *self, PyObject *arg)
{ … }
static PyObject *
unicode_decodeutf16(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_decodeutf16stateful(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_asutf16string(PyObject *self, PyObject *arg)
{ … }
static PyObject *
unicode_decodeunicodeescape(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_asunicodeescapestring(PyObject *self, PyObject *arg)
{ … }
static PyObject *
unicode_decoderawunicodeescape(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_asrawunicodeescapestring(PyObject *self, PyObject *arg)
{ … }
static PyObject *
unicode_decodelatin1(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_aslatin1string(PyObject *self, PyObject *arg)
{ … }
static PyObject *
unicode_decodeascii(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_asasciistring(PyObject *self, PyObject *arg)
{ … }
static PyObject *
unicode_decodecharmap(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_ascharmapstring(PyObject *self, PyObject *args)
{ … }
#ifdef MS_WINDOWS
static PyObject *
unicode_decodembcs(PyObject *self, PyObject *args)
{
const char *data;
Py_ssize_t size;
const char *errors = NULL;
if (!PyArg_ParseTuple(args, "y#|z", &data, &size, &errors))
return NULL;
return PyUnicode_DecodeMBCS(data, size, errors);
}
static PyObject *
unicode_decodembcsstateful(PyObject *self, PyObject *args)
{
const char *data;
Py_ssize_t size;
const char *errors = NULL;
Py_ssize_t consumed = UNINITIALIZED_SIZE;
PyObject *result;
if (!PyArg_ParseTuple(args, "y#|z", &data, &size, &errors))
return NULL;
result = PyUnicode_DecodeMBCSStateful(data, size, errors, &consumed);
if (!result) {
assert(consumed == UNINITIALIZED_SIZE);
return NULL;
}
return Py_BuildValue("(Nn)", result, consumed);
}
static PyObject *
unicode_decodecodepagestateful(PyObject *self, PyObject *args)
{
int code_page;
const char *data;
Py_ssize_t size;
const char *errors = NULL;
Py_ssize_t consumed = UNINITIALIZED_SIZE;
PyObject *result;
if (!PyArg_ParseTuple(args, "iy#|z", &code_page, &data, &size, &errors))
return NULL;
result = PyUnicode_DecodeCodePageStateful(code_page, data, size, errors, &consumed);
if (!result) {
assert(consumed == UNINITIALIZED_SIZE);
return NULL;
}
return Py_BuildValue("(Nn)", result, consumed);
}
static PyObject *
unicode_asmbcsstring(PyObject *self, PyObject *arg)
{
NULLABLE(arg);
return PyUnicode_AsMBCSString(arg);
}
static PyObject *
unicode_encodecodepage(PyObject *self, PyObject *args)
{
int code_page;
PyObject *unicode;
const char *errors;
if (!PyArg_ParseTuple(args, "iO|z", &code_page, &unicode, &errors))
return NULL;
NULLABLE(unicode);
return PyUnicode_EncodeCodePage(code_page, unicode, errors);
}
#endif
static PyObject *
unicode_decodelocaleandsize(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_decodelocale(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_encodelocale(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_decodefsdefault(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_decodefsdefaultandsize(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_encodefsdefault(PyObject *self, PyObject *arg)
{ … }
static PyObject *
unicode_concat(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_split(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_rsplit(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_splitlines(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_partition(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_rpartition(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_translate(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_join(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_count(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_find(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_tailmatch(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_findchar(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_replace(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_compare(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_comparewithasciistring(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_equaltoutf8(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_equaltoutf8andsize(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_richcompare(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_format(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_contains(PyObject *self, PyObject *args)
{ … }
static PyObject *
unicode_isidentifier(PyObject *self, PyObject *arg)
{ … }
static int
check_raised_systemerror(PyObject *result, char* msg)
{ … }
static PyObject *
test_string_from_format(PyObject *self, PyObject *Py_UNUSED(ignored))
{ … }
static PyObject *
unicode_equal(PyObject *module, PyObject *args)
{ … }
static PyMethodDef TestMethods[] = …;
int
_PyTestLimitedCAPI_Init_Unicode(PyObject *m)
{ … }