2015-04-03 17:53:51 -03:00
|
|
|
/*[clinic input]
|
|
|
|
preserve
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
2015-05-12 07:15:57 -03:00
|
|
|
PyDoc_STRVAR(_codecs_register__doc__,
|
|
|
|
"register($module, search_function, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Register a codec search function.\n"
|
|
|
|
"\n"
|
|
|
|
"Search functions are expected to take one argument, the encoding name in\n"
|
|
|
|
"all lower case letters, and either return None, or a tuple of functions\n"
|
|
|
|
"(encoder, decoder, stream_reader, stream_writer) (or a CodecInfo object).");
|
|
|
|
|
|
|
|
#define _CODECS_REGISTER_METHODDEF \
|
|
|
|
{"register", (PyCFunction)_codecs_register, METH_O, _codecs_register__doc__},
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_lookup__doc__,
|
|
|
|
"lookup($module, encoding, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Looks up a codec tuple in the Python codec registry and returns a CodecInfo object.");
|
|
|
|
|
|
|
|
#define _CODECS_LOOKUP_METHODDEF \
|
|
|
|
{"lookup", (PyCFunction)_codecs_lookup, METH_O, _codecs_lookup__doc__},
|
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_lookup_impl(PyObject *module, const char *encoding);
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_lookup(PyObject *module, PyObject *arg)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
const char *encoding;
|
|
|
|
|
2016-06-09 10:16:06 -03:00
|
|
|
if (!PyArg_Parse(arg, "s:lookup", &encoding)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_lookup_impl(module, encoding);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_encode__doc__,
|
2015-08-09 06:23:08 -03:00
|
|
|
"encode($module, /, obj, encoding=\'utf-8\', errors=\'strict\')\n"
|
2015-05-12 07:15:57 -03:00
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Encodes obj using the codec registered for encoding.\n"
|
|
|
|
"\n"
|
2015-08-09 06:23:08 -03:00
|
|
|
"The default encoding is \'utf-8\'. errors may be given to set a\n"
|
2015-05-12 07:15:57 -03:00
|
|
|
"different error handling scheme. Default is \'strict\' meaning that encoding\n"
|
|
|
|
"errors raise a ValueError. Other possible values are \'ignore\', \'replace\'\n"
|
|
|
|
"and \'backslashreplace\' as well as any other name registered with\n"
|
|
|
|
"codecs.register_error that can handle ValueErrors.");
|
|
|
|
|
|
|
|
#define _CODECS_ENCODE_METHODDEF \
|
2016-09-10 00:00:13 -03:00
|
|
|
{"encode", (PyCFunction)_codecs_encode, METH_FASTCALL, _codecs_encode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_encode_impl(PyObject *module, PyObject *obj, const char *encoding,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors);
|
|
|
|
|
|
|
|
static PyObject *
|
2016-09-10 00:00:13 -03:00
|
|
|
_codecs_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
2016-08-14 04:52:18 -03:00
|
|
|
static const char * const _keywords[] = {"obj", "encoding", "errors", NULL};
|
|
|
|
static _PyArg_Parser _parser = {"O|ss:encode", _keywords, 0};
|
2015-05-12 07:15:57 -03:00
|
|
|
PyObject *obj;
|
|
|
|
const char *encoding = NULL;
|
|
|
|
const char *errors = NULL;
|
|
|
|
|
2017-01-16 20:29:01 -04:00
|
|
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
2016-06-09 10:16:06 -03:00
|
|
|
&obj, &encoding, &errors)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_encode_impl(module, obj, encoding, errors);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_decode__doc__,
|
2015-08-09 06:23:08 -03:00
|
|
|
"decode($module, /, obj, encoding=\'utf-8\', errors=\'strict\')\n"
|
2015-05-12 07:15:57 -03:00
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Decodes obj using the codec registered for encoding.\n"
|
|
|
|
"\n"
|
2015-08-09 06:23:08 -03:00
|
|
|
"Default encoding is \'utf-8\'. errors may be given to set a\n"
|
2015-05-12 07:15:57 -03:00
|
|
|
"different error handling scheme. Default is \'strict\' meaning that encoding\n"
|
|
|
|
"errors raise a ValueError. Other possible values are \'ignore\', \'replace\'\n"
|
|
|
|
"and \'backslashreplace\' as well as any other name registered with\n"
|
|
|
|
"codecs.register_error that can handle ValueErrors.");
|
|
|
|
|
|
|
|
#define _CODECS_DECODE_METHODDEF \
|
2016-09-10 00:00:13 -03:00
|
|
|
{"decode", (PyCFunction)_codecs_decode, METH_FASTCALL, _codecs_decode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_decode_impl(PyObject *module, PyObject *obj, const char *encoding,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors);
|
|
|
|
|
|
|
|
static PyObject *
|
2016-09-10 00:00:13 -03:00
|
|
|
_codecs_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
2016-08-14 04:52:18 -03:00
|
|
|
static const char * const _keywords[] = {"obj", "encoding", "errors", NULL};
|
|
|
|
static _PyArg_Parser _parser = {"O|ss:decode", _keywords, 0};
|
2015-05-12 07:15:57 -03:00
|
|
|
PyObject *obj;
|
|
|
|
const char *encoding = NULL;
|
|
|
|
const char *errors = NULL;
|
|
|
|
|
2017-01-16 20:29:01 -04:00
|
|
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
2016-06-09 10:16:06 -03:00
|
|
|
&obj, &encoding, &errors)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_decode_impl(module, obj, encoding, errors);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
2015-04-03 17:53:51 -03:00
|
|
|
PyDoc_STRVAR(_codecs__forget_codec__doc__,
|
|
|
|
"_forget_codec($module, encoding, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Purge the named codec from the internal codec lookup cache");
|
|
|
|
|
|
|
|
#define _CODECS__FORGET_CODEC_METHODDEF \
|
2015-04-03 18:12:11 -03:00
|
|
|
{"_forget_codec", (PyCFunction)_codecs__forget_codec, METH_O, _codecs__forget_codec__doc__},
|
2015-04-03 17:53:51 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs__forget_codec_impl(PyObject *module, const char *encoding);
|
2015-04-03 17:53:51 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs__forget_codec(PyObject *module, PyObject *arg)
|
2015-04-03 17:53:51 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
const char *encoding;
|
|
|
|
|
2016-06-09 10:16:06 -03:00
|
|
|
if (!PyArg_Parse(arg, "s:_forget_codec", &encoding)) {
|
2015-04-03 17:53:51 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-04-03 17:53:51 -03:00
|
|
|
return_value = _codecs__forget_codec_impl(module, encoding);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_escape_decode__doc__,
|
|
|
|
"escape_decode($module, data, errors=None, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_ESCAPE_DECODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"escape_decode", (PyCFunction)_codecs_escape_decode, METH_FASTCALL, _codecs_escape_decode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_escape_decode_impl(PyObject *module, Py_buffer *data,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_escape_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
const char *errors = NULL;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "s*|z:escape_decode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&data, &errors)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("escape_decode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_escape_decode_impl(module, &data, errors);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2015-05-12 07:15:57 -03:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_escape_encode__doc__,
|
|
|
|
"escape_encode($module, data, errors=None, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_ESCAPE_ENCODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"escape_encode", (PyCFunction)_codecs_escape_encode, METH_FASTCALL, _codecs_escape_encode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_escape_encode_impl(PyObject *module, PyObject *data,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_escape_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
PyObject *data;
|
|
|
|
const char *errors = NULL;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "O!|z:escape_encode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&PyBytes_Type, &data, &errors)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("escape_encode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_escape_encode_impl(module, data, errors);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_unicode_internal_decode__doc__,
|
|
|
|
"unicode_internal_decode($module, obj, errors=None, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_UNICODE_INTERNAL_DECODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"unicode_internal_decode", (PyCFunction)_codecs_unicode_internal_decode, METH_FASTCALL, _codecs_unicode_internal_decode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_unicode_internal_decode_impl(PyObject *module, PyObject *obj,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_unicode_internal_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
PyObject *obj;
|
|
|
|
const char *errors = NULL;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "O|z:unicode_internal_decode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&obj, &errors)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("unicode_internal_decode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_unicode_internal_decode_impl(module, obj, errors);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_utf_7_decode__doc__,
|
|
|
|
"utf_7_decode($module, data, errors=None, final=False, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_UTF_7_DECODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"utf_7_decode", (PyCFunction)_codecs_utf_7_decode, METH_FASTCALL, _codecs_utf_7_decode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_utf_7_decode_impl(PyObject *module, Py_buffer *data,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors, int final);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_utf_7_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
const char *errors = NULL;
|
|
|
|
int final = 0;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "y*|zi:utf_7_decode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&data, &errors, &final)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("utf_7_decode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_utf_7_decode_impl(module, &data, errors, final);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2015-05-12 07:15:57 -03:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_utf_8_decode__doc__,
|
|
|
|
"utf_8_decode($module, data, errors=None, final=False, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_UTF_8_DECODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"utf_8_decode", (PyCFunction)_codecs_utf_8_decode, METH_FASTCALL, _codecs_utf_8_decode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_utf_8_decode_impl(PyObject *module, Py_buffer *data,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors, int final);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_utf_8_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
const char *errors = NULL;
|
|
|
|
int final = 0;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "y*|zi:utf_8_decode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&data, &errors, &final)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("utf_8_decode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_utf_8_decode_impl(module, &data, errors, final);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2015-05-12 07:15:57 -03:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_utf_16_decode__doc__,
|
|
|
|
"utf_16_decode($module, data, errors=None, final=False, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_UTF_16_DECODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"utf_16_decode", (PyCFunction)_codecs_utf_16_decode, METH_FASTCALL, _codecs_utf_16_decode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_utf_16_decode_impl(PyObject *module, Py_buffer *data,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors, int final);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_utf_16_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
const char *errors = NULL;
|
|
|
|
int final = 0;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "y*|zi:utf_16_decode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&data, &errors, &final)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("utf_16_decode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_utf_16_decode_impl(module, &data, errors, final);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2015-05-12 07:15:57 -03:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_utf_16_le_decode__doc__,
|
|
|
|
"utf_16_le_decode($module, data, errors=None, final=False, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_UTF_16_LE_DECODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"utf_16_le_decode", (PyCFunction)_codecs_utf_16_le_decode, METH_FASTCALL, _codecs_utf_16_le_decode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_utf_16_le_decode_impl(PyObject *module, Py_buffer *data,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors, int final);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_utf_16_le_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
const char *errors = NULL;
|
|
|
|
int final = 0;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "y*|zi:utf_16_le_decode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&data, &errors, &final)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("utf_16_le_decode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_utf_16_le_decode_impl(module, &data, errors, final);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2015-05-12 07:15:57 -03:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_utf_16_be_decode__doc__,
|
|
|
|
"utf_16_be_decode($module, data, errors=None, final=False, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_UTF_16_BE_DECODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"utf_16_be_decode", (PyCFunction)_codecs_utf_16_be_decode, METH_FASTCALL, _codecs_utf_16_be_decode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_utf_16_be_decode_impl(PyObject *module, Py_buffer *data,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors, int final);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_utf_16_be_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
const char *errors = NULL;
|
|
|
|
int final = 0;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "y*|zi:utf_16_be_decode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&data, &errors, &final)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("utf_16_be_decode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_utf_16_be_decode_impl(module, &data, errors, final);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2015-05-12 07:15:57 -03:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_utf_16_ex_decode__doc__,
|
|
|
|
"utf_16_ex_decode($module, data, errors=None, byteorder=0, final=False,\n"
|
|
|
|
" /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_UTF_16_EX_DECODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"utf_16_ex_decode", (PyCFunction)_codecs_utf_16_ex_decode, METH_FASTCALL, _codecs_utf_16_ex_decode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_utf_16_ex_decode_impl(PyObject *module, Py_buffer *data,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors, int byteorder, int final);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_utf_16_ex_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
const char *errors = NULL;
|
|
|
|
int byteorder = 0;
|
|
|
|
int final = 0;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "y*|zii:utf_16_ex_decode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&data, &errors, &byteorder, &final)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("utf_16_ex_decode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_utf_16_ex_decode_impl(module, &data, errors, byteorder, final);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2015-05-12 07:15:57 -03:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_utf_32_decode__doc__,
|
|
|
|
"utf_32_decode($module, data, errors=None, final=False, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_UTF_32_DECODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"utf_32_decode", (PyCFunction)_codecs_utf_32_decode, METH_FASTCALL, _codecs_utf_32_decode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_utf_32_decode_impl(PyObject *module, Py_buffer *data,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors, int final);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_utf_32_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
const char *errors = NULL;
|
|
|
|
int final = 0;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "y*|zi:utf_32_decode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&data, &errors, &final)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("utf_32_decode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_utf_32_decode_impl(module, &data, errors, final);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2015-05-12 07:15:57 -03:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_utf_32_le_decode__doc__,
|
|
|
|
"utf_32_le_decode($module, data, errors=None, final=False, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_UTF_32_LE_DECODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"utf_32_le_decode", (PyCFunction)_codecs_utf_32_le_decode, METH_FASTCALL, _codecs_utf_32_le_decode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_utf_32_le_decode_impl(PyObject *module, Py_buffer *data,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors, int final);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_utf_32_le_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
const char *errors = NULL;
|
|
|
|
int final = 0;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "y*|zi:utf_32_le_decode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&data, &errors, &final)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("utf_32_le_decode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_utf_32_le_decode_impl(module, &data, errors, final);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2015-05-12 07:15:57 -03:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_utf_32_be_decode__doc__,
|
|
|
|
"utf_32_be_decode($module, data, errors=None, final=False, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_UTF_32_BE_DECODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"utf_32_be_decode", (PyCFunction)_codecs_utf_32_be_decode, METH_FASTCALL, _codecs_utf_32_be_decode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_utf_32_be_decode_impl(PyObject *module, Py_buffer *data,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors, int final);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_utf_32_be_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
const char *errors = NULL;
|
|
|
|
int final = 0;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "y*|zi:utf_32_be_decode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&data, &errors, &final)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("utf_32_be_decode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_utf_32_be_decode_impl(module, &data, errors, final);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2015-05-12 07:15:57 -03:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_utf_32_ex_decode__doc__,
|
|
|
|
"utf_32_ex_decode($module, data, errors=None, byteorder=0, final=False,\n"
|
|
|
|
" /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_UTF_32_EX_DECODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"utf_32_ex_decode", (PyCFunction)_codecs_utf_32_ex_decode, METH_FASTCALL, _codecs_utf_32_ex_decode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_utf_32_ex_decode_impl(PyObject *module, Py_buffer *data,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors, int byteorder, int final);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_utf_32_ex_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
const char *errors = NULL;
|
|
|
|
int byteorder = 0;
|
|
|
|
int final = 0;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "y*|zii:utf_32_ex_decode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&data, &errors, &byteorder, &final)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("utf_32_ex_decode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_utf_32_ex_decode_impl(module, &data, errors, byteorder, final);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2015-05-12 07:15:57 -03:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_unicode_escape_decode__doc__,
|
|
|
|
"unicode_escape_decode($module, data, errors=None, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_UNICODE_ESCAPE_DECODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"unicode_escape_decode", (PyCFunction)_codecs_unicode_escape_decode, METH_FASTCALL, _codecs_unicode_escape_decode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_unicode_escape_decode_impl(PyObject *module, Py_buffer *data,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_unicode_escape_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
const char *errors = NULL;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "s*|z:unicode_escape_decode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&data, &errors)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("unicode_escape_decode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_unicode_escape_decode_impl(module, &data, errors);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2015-05-12 07:15:57 -03:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_raw_unicode_escape_decode__doc__,
|
|
|
|
"raw_unicode_escape_decode($module, data, errors=None, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_RAW_UNICODE_ESCAPE_DECODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"raw_unicode_escape_decode", (PyCFunction)_codecs_raw_unicode_escape_decode, METH_FASTCALL, _codecs_raw_unicode_escape_decode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_raw_unicode_escape_decode_impl(PyObject *module, Py_buffer *data,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_raw_unicode_escape_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
const char *errors = NULL;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "s*|z:raw_unicode_escape_decode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&data, &errors)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("raw_unicode_escape_decode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_raw_unicode_escape_decode_impl(module, &data, errors);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2015-05-12 07:15:57 -03:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_latin_1_decode__doc__,
|
|
|
|
"latin_1_decode($module, data, errors=None, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_LATIN_1_DECODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"latin_1_decode", (PyCFunction)_codecs_latin_1_decode, METH_FASTCALL, _codecs_latin_1_decode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_latin_1_decode_impl(PyObject *module, Py_buffer *data,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_latin_1_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
const char *errors = NULL;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "y*|z:latin_1_decode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&data, &errors)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("latin_1_decode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_latin_1_decode_impl(module, &data, errors);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2015-05-12 07:15:57 -03:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_ascii_decode__doc__,
|
|
|
|
"ascii_decode($module, data, errors=None, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_ASCII_DECODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"ascii_decode", (PyCFunction)_codecs_ascii_decode, METH_FASTCALL, _codecs_ascii_decode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_ascii_decode_impl(PyObject *module, Py_buffer *data,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_ascii_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
const char *errors = NULL;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "y*|z:ascii_decode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&data, &errors)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("ascii_decode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_ascii_decode_impl(module, &data, errors);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2015-05-12 07:15:57 -03:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_charmap_decode__doc__,
|
|
|
|
"charmap_decode($module, data, errors=None, mapping=None, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_CHARMAP_DECODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"charmap_decode", (PyCFunction)_codecs_charmap_decode, METH_FASTCALL, _codecs_charmap_decode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_charmap_decode_impl(PyObject *module, Py_buffer *data,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors, PyObject *mapping);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_charmap_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
const char *errors = NULL;
|
|
|
|
PyObject *mapping = NULL;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "y*|zO:charmap_decode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&data, &errors, &mapping)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("charmap_decode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_charmap_decode_impl(module, &data, errors, mapping);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2015-05-12 07:15:57 -03:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
2016-09-08 14:35:16 -03:00
|
|
|
#if defined(MS_WINDOWS)
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_mbcs_decode__doc__,
|
|
|
|
"mbcs_decode($module, data, errors=None, final=False, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_MBCS_DECODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"mbcs_decode", (PyCFunction)_codecs_mbcs_decode, METH_FASTCALL, _codecs_mbcs_decode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_mbcs_decode_impl(PyObject *module, Py_buffer *data,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors, int final);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_mbcs_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
const char *errors = NULL;
|
|
|
|
int final = 0;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "y*|zi:mbcs_decode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&data, &errors, &final)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("mbcs_decode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_mbcs_decode_impl(module, &data, errors, final);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2015-05-12 07:15:57 -03:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
2016-09-08 14:35:16 -03:00
|
|
|
#endif /* defined(MS_WINDOWS) */
|
2015-05-12 07:15:57 -03:00
|
|
|
|
2016-09-08 14:35:16 -03:00
|
|
|
#if defined(MS_WINDOWS)
|
2015-05-12 07:15:57 -03:00
|
|
|
|
2016-09-06 23:42:27 -03:00
|
|
|
PyDoc_STRVAR(_codecs_oem_decode__doc__,
|
|
|
|
"oem_decode($module, data, errors=None, final=False, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_OEM_DECODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"oem_decode", (PyCFunction)_codecs_oem_decode, METH_FASTCALL, _codecs_oem_decode__doc__},
|
2016-09-06 23:42:27 -03:00
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
_codecs_oem_decode_impl(PyObject *module, Py_buffer *data,
|
|
|
|
const char *errors, int final);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_oem_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2016-09-06 23:42:27 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
const char *errors = NULL;
|
|
|
|
int final = 0;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "y*|zi:oem_decode",
|
2016-09-06 23:42:27 -03:00
|
|
|
&data, &errors, &final)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("oem_decode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2016-09-06 23:42:27 -03:00
|
|
|
return_value = _codecs_oem_decode_impl(module, &data, errors, final);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
|
|
|
if (data.obj) {
|
|
|
|
PyBuffer_Release(&data);
|
|
|
|
}
|
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
2016-09-08 14:35:16 -03:00
|
|
|
#endif /* defined(MS_WINDOWS) */
|
2016-09-06 23:42:27 -03:00
|
|
|
|
2016-09-08 14:35:16 -03:00
|
|
|
#if defined(MS_WINDOWS)
|
2016-09-06 23:42:27 -03:00
|
|
|
|
2015-05-12 07:15:57 -03:00
|
|
|
PyDoc_STRVAR(_codecs_code_page_decode__doc__,
|
|
|
|
"code_page_decode($module, codepage, data, errors=None, final=False, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_CODE_PAGE_DECODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"code_page_decode", (PyCFunction)_codecs_code_page_decode, METH_FASTCALL, _codecs_code_page_decode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_code_page_decode_impl(PyObject *module, int codepage,
|
2015-05-12 07:15:57 -03:00
|
|
|
Py_buffer *data, const char *errors, int final);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_code_page_decode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
int codepage;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
const char *errors = NULL;
|
|
|
|
int final = 0;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "iy*|zi:code_page_decode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&codepage, &data, &errors, &final)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("code_page_decode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_code_page_decode_impl(module, codepage, &data, errors, final);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2015-05-12 07:15:57 -03:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
2016-09-08 14:35:16 -03:00
|
|
|
#endif /* defined(MS_WINDOWS) */
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_readbuffer_encode__doc__,
|
|
|
|
"readbuffer_encode($module, data, errors=None, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_READBUFFER_ENCODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"readbuffer_encode", (PyCFunction)_codecs_readbuffer_encode, METH_FASTCALL, _codecs_readbuffer_encode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_readbuffer_encode_impl(PyObject *module, Py_buffer *data,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_readbuffer_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
const char *errors = NULL;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "s*|z:readbuffer_encode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&data, &errors)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("readbuffer_encode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_readbuffer_encode_impl(module, &data, errors);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2015-05-12 07:15:57 -03:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_unicode_internal_encode__doc__,
|
|
|
|
"unicode_internal_encode($module, obj, errors=None, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_UNICODE_INTERNAL_ENCODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"unicode_internal_encode", (PyCFunction)_codecs_unicode_internal_encode, METH_FASTCALL, _codecs_unicode_internal_encode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_unicode_internal_encode_impl(PyObject *module, PyObject *obj,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_unicode_internal_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
PyObject *obj;
|
|
|
|
const char *errors = NULL;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "O|z:unicode_internal_encode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&obj, &errors)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("unicode_internal_encode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_unicode_internal_encode_impl(module, obj, errors);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_utf_7_encode__doc__,
|
|
|
|
"utf_7_encode($module, str, errors=None, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_UTF_7_ENCODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"utf_7_encode", (PyCFunction)_codecs_utf_7_encode, METH_FASTCALL, _codecs_utf_7_encode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_utf_7_encode_impl(PyObject *module, PyObject *str,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_utf_7_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
PyObject *str;
|
|
|
|
const char *errors = NULL;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "U|z:utf_7_encode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&str, &errors)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("utf_7_encode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_utf_7_encode_impl(module, str, errors);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_utf_8_encode__doc__,
|
|
|
|
"utf_8_encode($module, str, errors=None, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_UTF_8_ENCODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"utf_8_encode", (PyCFunction)_codecs_utf_8_encode, METH_FASTCALL, _codecs_utf_8_encode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_utf_8_encode_impl(PyObject *module, PyObject *str,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_utf_8_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
PyObject *str;
|
|
|
|
const char *errors = NULL;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "U|z:utf_8_encode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&str, &errors)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("utf_8_encode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_utf_8_encode_impl(module, str, errors);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_utf_16_encode__doc__,
|
|
|
|
"utf_16_encode($module, str, errors=None, byteorder=0, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_UTF_16_ENCODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"utf_16_encode", (PyCFunction)_codecs_utf_16_encode, METH_FASTCALL, _codecs_utf_16_encode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_utf_16_encode_impl(PyObject *module, PyObject *str,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors, int byteorder);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_utf_16_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
PyObject *str;
|
|
|
|
const char *errors = NULL;
|
|
|
|
int byteorder = 0;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "U|zi:utf_16_encode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&str, &errors, &byteorder)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("utf_16_encode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_utf_16_encode_impl(module, str, errors, byteorder);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_utf_16_le_encode__doc__,
|
|
|
|
"utf_16_le_encode($module, str, errors=None, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_UTF_16_LE_ENCODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"utf_16_le_encode", (PyCFunction)_codecs_utf_16_le_encode, METH_FASTCALL, _codecs_utf_16_le_encode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_utf_16_le_encode_impl(PyObject *module, PyObject *str,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_utf_16_le_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
PyObject *str;
|
|
|
|
const char *errors = NULL;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "U|z:utf_16_le_encode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&str, &errors)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("utf_16_le_encode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_utf_16_le_encode_impl(module, str, errors);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_utf_16_be_encode__doc__,
|
|
|
|
"utf_16_be_encode($module, str, errors=None, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_UTF_16_BE_ENCODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"utf_16_be_encode", (PyCFunction)_codecs_utf_16_be_encode, METH_FASTCALL, _codecs_utf_16_be_encode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_utf_16_be_encode_impl(PyObject *module, PyObject *str,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_utf_16_be_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
PyObject *str;
|
|
|
|
const char *errors = NULL;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "U|z:utf_16_be_encode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&str, &errors)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("utf_16_be_encode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_utf_16_be_encode_impl(module, str, errors);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_utf_32_encode__doc__,
|
|
|
|
"utf_32_encode($module, str, errors=None, byteorder=0, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_UTF_32_ENCODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"utf_32_encode", (PyCFunction)_codecs_utf_32_encode, METH_FASTCALL, _codecs_utf_32_encode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_utf_32_encode_impl(PyObject *module, PyObject *str,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors, int byteorder);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_utf_32_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
PyObject *str;
|
|
|
|
const char *errors = NULL;
|
|
|
|
int byteorder = 0;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "U|zi:utf_32_encode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&str, &errors, &byteorder)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("utf_32_encode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_utf_32_encode_impl(module, str, errors, byteorder);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_utf_32_le_encode__doc__,
|
|
|
|
"utf_32_le_encode($module, str, errors=None, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_UTF_32_LE_ENCODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"utf_32_le_encode", (PyCFunction)_codecs_utf_32_le_encode, METH_FASTCALL, _codecs_utf_32_le_encode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_utf_32_le_encode_impl(PyObject *module, PyObject *str,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_utf_32_le_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
PyObject *str;
|
|
|
|
const char *errors = NULL;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "U|z:utf_32_le_encode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&str, &errors)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("utf_32_le_encode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_utf_32_le_encode_impl(module, str, errors);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_utf_32_be_encode__doc__,
|
|
|
|
"utf_32_be_encode($module, str, errors=None, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_UTF_32_BE_ENCODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"utf_32_be_encode", (PyCFunction)_codecs_utf_32_be_encode, METH_FASTCALL, _codecs_utf_32_be_encode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_utf_32_be_encode_impl(PyObject *module, PyObject *str,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_utf_32_be_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
PyObject *str;
|
|
|
|
const char *errors = NULL;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "U|z:utf_32_be_encode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&str, &errors)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("utf_32_be_encode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_utf_32_be_encode_impl(module, str, errors);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_unicode_escape_encode__doc__,
|
|
|
|
"unicode_escape_encode($module, str, errors=None, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_UNICODE_ESCAPE_ENCODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"unicode_escape_encode", (PyCFunction)_codecs_unicode_escape_encode, METH_FASTCALL, _codecs_unicode_escape_encode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_unicode_escape_encode_impl(PyObject *module, PyObject *str,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_unicode_escape_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
PyObject *str;
|
|
|
|
const char *errors = NULL;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "U|z:unicode_escape_encode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&str, &errors)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("unicode_escape_encode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_unicode_escape_encode_impl(module, str, errors);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_raw_unicode_escape_encode__doc__,
|
|
|
|
"raw_unicode_escape_encode($module, str, errors=None, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_RAW_UNICODE_ESCAPE_ENCODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"raw_unicode_escape_encode", (PyCFunction)_codecs_raw_unicode_escape_encode, METH_FASTCALL, _codecs_raw_unicode_escape_encode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_raw_unicode_escape_encode_impl(PyObject *module, PyObject *str,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_raw_unicode_escape_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
PyObject *str;
|
|
|
|
const char *errors = NULL;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "U|z:raw_unicode_escape_encode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&str, &errors)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("raw_unicode_escape_encode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_raw_unicode_escape_encode_impl(module, str, errors);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_latin_1_encode__doc__,
|
|
|
|
"latin_1_encode($module, str, errors=None, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_LATIN_1_ENCODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"latin_1_encode", (PyCFunction)_codecs_latin_1_encode, METH_FASTCALL, _codecs_latin_1_encode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_latin_1_encode_impl(PyObject *module, PyObject *str,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_latin_1_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
PyObject *str;
|
|
|
|
const char *errors = NULL;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "U|z:latin_1_encode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&str, &errors)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("latin_1_encode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_latin_1_encode_impl(module, str, errors);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_ascii_encode__doc__,
|
|
|
|
"ascii_encode($module, str, errors=None, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_ASCII_ENCODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"ascii_encode", (PyCFunction)_codecs_ascii_encode, METH_FASTCALL, _codecs_ascii_encode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_ascii_encode_impl(PyObject *module, PyObject *str,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_ascii_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
PyObject *str;
|
|
|
|
const char *errors = NULL;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "U|z:ascii_encode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&str, &errors)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("ascii_encode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_ascii_encode_impl(module, str, errors);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_charmap_encode__doc__,
|
|
|
|
"charmap_encode($module, str, errors=None, mapping=None, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_CHARMAP_ENCODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"charmap_encode", (PyCFunction)_codecs_charmap_encode, METH_FASTCALL, _codecs_charmap_encode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_charmap_encode_impl(PyObject *module, PyObject *str,
|
2015-05-12 07:15:57 -03:00
|
|
|
const char *errors, PyObject *mapping);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_charmap_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
PyObject *str;
|
|
|
|
const char *errors = NULL;
|
|
|
|
PyObject *mapping = NULL;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "U|zO:charmap_encode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&str, &errors, &mapping)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("charmap_encode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_charmap_encode_impl(module, str, errors, mapping);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_charmap_build__doc__,
|
|
|
|
"charmap_build($module, map, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_CHARMAP_BUILD_METHODDEF \
|
|
|
|
{"charmap_build", (PyCFunction)_codecs_charmap_build, METH_O, _codecs_charmap_build__doc__},
|
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_charmap_build_impl(PyObject *module, PyObject *map);
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_charmap_build(PyObject *module, PyObject *arg)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
PyObject *map;
|
|
|
|
|
2016-06-09 10:16:06 -03:00
|
|
|
if (!PyArg_Parse(arg, "U:charmap_build", &map)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_charmap_build_impl(module, map);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
2016-09-08 14:35:16 -03:00
|
|
|
#if defined(MS_WINDOWS)
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_mbcs_encode__doc__,
|
|
|
|
"mbcs_encode($module, str, errors=None, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_MBCS_ENCODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"mbcs_encode", (PyCFunction)_codecs_mbcs_encode, METH_FASTCALL, _codecs_mbcs_encode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_mbcs_encode_impl(PyObject *module, PyObject *str, const char *errors);
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_mbcs_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
PyObject *str;
|
|
|
|
const char *errors = NULL;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "U|z:mbcs_encode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&str, &errors)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("mbcs_encode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_mbcs_encode_impl(module, str, errors);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
2016-09-08 14:35:16 -03:00
|
|
|
#endif /* defined(MS_WINDOWS) */
|
2015-05-12 07:15:57 -03:00
|
|
|
|
2016-09-08 14:35:16 -03:00
|
|
|
#if defined(MS_WINDOWS)
|
2015-05-12 07:15:57 -03:00
|
|
|
|
2016-09-06 23:42:27 -03:00
|
|
|
PyDoc_STRVAR(_codecs_oem_encode__doc__,
|
|
|
|
"oem_encode($module, str, errors=None, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_OEM_ENCODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"oem_encode", (PyCFunction)_codecs_oem_encode, METH_FASTCALL, _codecs_oem_encode__doc__},
|
2016-09-06 23:42:27 -03:00
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
_codecs_oem_encode_impl(PyObject *module, PyObject *str, const char *errors);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_oem_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2016-09-06 23:42:27 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
PyObject *str;
|
|
|
|
const char *errors = NULL;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "U|z:oem_encode",
|
2016-09-06 23:42:27 -03:00
|
|
|
&str, &errors)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("oem_encode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2016-09-06 23:42:27 -03:00
|
|
|
return_value = _codecs_oem_encode_impl(module, str, errors);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
2016-09-08 14:35:16 -03:00
|
|
|
#endif /* defined(MS_WINDOWS) */
|
2016-09-06 23:42:27 -03:00
|
|
|
|
2016-09-08 14:35:16 -03:00
|
|
|
#if defined(MS_WINDOWS)
|
2016-09-06 23:42:27 -03:00
|
|
|
|
2015-05-12 07:15:57 -03:00
|
|
|
PyDoc_STRVAR(_codecs_code_page_encode__doc__,
|
|
|
|
"code_page_encode($module, code_page, str, errors=None, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _CODECS_CODE_PAGE_ENCODE_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"code_page_encode", (PyCFunction)_codecs_code_page_encode, METH_FASTCALL, _codecs_code_page_encode__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_code_page_encode_impl(PyObject *module, int code_page, PyObject *str,
|
|
|
|
const char *errors);
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_code_page_encode(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
int code_page;
|
|
|
|
PyObject *str;
|
|
|
|
const char *errors = NULL;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "iU|z:code_page_encode",
|
2016-06-09 10:16:06 -03:00
|
|
|
&code_page, &str, &errors)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("code_page_encode", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_code_page_encode_impl(module, code_page, str, errors);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
2016-09-08 14:35:16 -03:00
|
|
|
#endif /* defined(MS_WINDOWS) */
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_register_error__doc__,
|
|
|
|
"register_error($module, errors, handler, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Register the specified error handler under the name errors.\n"
|
|
|
|
"\n"
|
|
|
|
"handler must be a callable object, that will be called with an exception\n"
|
|
|
|
"instance containing information about the location of the encoding/decoding\n"
|
|
|
|
"error and must return a (replacement, new position) tuple.");
|
|
|
|
|
|
|
|
#define _CODECS_REGISTER_ERROR_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"register_error", (PyCFunction)_codecs_register_error, METH_FASTCALL, _codecs_register_error__doc__},
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_register_error_impl(PyObject *module, const char *errors,
|
2015-05-12 07:15:57 -03:00
|
|
|
PyObject *handler);
|
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
_codecs_register_error(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
const char *errors;
|
|
|
|
PyObject *handler;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "sO:register_error",
|
2016-06-09 10:16:06 -03:00
|
|
|
&errors, &handler)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("register_error", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_register_error_impl(module, errors, handler);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_codecs_lookup_error__doc__,
|
|
|
|
"lookup_error($module, name, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"lookup_error(errors) -> handler\n"
|
|
|
|
"\n"
|
|
|
|
"Return the error handler for the specified error handling name or raise a\n"
|
|
|
|
"LookupError, if no handler exists under this name.");
|
|
|
|
|
|
|
|
#define _CODECS_LOOKUP_ERROR_METHODDEF \
|
|
|
|
{"lookup_error", (PyCFunction)_codecs_lookup_error, METH_O, _codecs_lookup_error__doc__},
|
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_lookup_error_impl(PyObject *module, const char *name);
|
2015-05-12 07:15:57 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
_codecs_lookup_error(PyObject *module, PyObject *arg)
|
2015-05-12 07:15:57 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
const char *name;
|
|
|
|
|
2016-06-09 10:16:06 -03:00
|
|
|
if (!PyArg_Parse(arg, "s:lookup_error", &name)) {
|
2015-05-12 07:15:57 -03:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-05-12 07:15:57 -03:00
|
|
|
return_value = _codecs_lookup_error_impl(module, name);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef _CODECS_MBCS_DECODE_METHODDEF
|
|
|
|
#define _CODECS_MBCS_DECODE_METHODDEF
|
|
|
|
#endif /* !defined(_CODECS_MBCS_DECODE_METHODDEF) */
|
|
|
|
|
2016-09-06 23:42:27 -03:00
|
|
|
#ifndef _CODECS_OEM_DECODE_METHODDEF
|
|
|
|
#define _CODECS_OEM_DECODE_METHODDEF
|
|
|
|
#endif /* !defined(_CODECS_OEM_DECODE_METHODDEF) */
|
|
|
|
|
2015-05-12 07:15:57 -03:00
|
|
|
#ifndef _CODECS_CODE_PAGE_DECODE_METHODDEF
|
|
|
|
#define _CODECS_CODE_PAGE_DECODE_METHODDEF
|
|
|
|
#endif /* !defined(_CODECS_CODE_PAGE_DECODE_METHODDEF) */
|
|
|
|
|
|
|
|
#ifndef _CODECS_MBCS_ENCODE_METHODDEF
|
|
|
|
#define _CODECS_MBCS_ENCODE_METHODDEF
|
|
|
|
#endif /* !defined(_CODECS_MBCS_ENCODE_METHODDEF) */
|
|
|
|
|
2016-09-06 23:42:27 -03:00
|
|
|
#ifndef _CODECS_OEM_ENCODE_METHODDEF
|
|
|
|
#define _CODECS_OEM_ENCODE_METHODDEF
|
|
|
|
#endif /* !defined(_CODECS_OEM_ENCODE_METHODDEF) */
|
|
|
|
|
2015-05-12 07:15:57 -03:00
|
|
|
#ifndef _CODECS_CODE_PAGE_ENCODE_METHODDEF
|
|
|
|
#define _CODECS_CODE_PAGE_ENCODE_METHODDEF
|
|
|
|
#endif /* !defined(_CODECS_CODE_PAGE_ENCODE_METHODDEF) */
|
2017-01-16 20:35:17 -04:00
|
|
|
/*[clinic end generated code: output=36fb42f450a3b4dc input=a9049054013a1b77]*/
|