Lines Matching refs:args
86 _codecs_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
97 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
98 if (!args) {
101 obj = args[0];
105 if (args[1]) {
106 if (!PyUnicode_Check(args[1])) {
107 _PyArg_BadArgument("encode", "argument 'encoding'", "str", args[1]);
111 encoding = PyUnicode_AsUTF8AndSize(args[1], &encoding_length);
123 if (!PyUnicode_Check(args[2])) {
124 _PyArg_BadArgument("encode", "argument 'errors'", "str", args[2]);
128 errors = PyUnicode_AsUTF8AndSize(args[2], &errors_length);
163 _codecs_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
174 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
175 if (!args) {
178 obj = args[0];
182 if (args[1]) {
183 if (!PyUnicode_Check(args[1])) {
184 _PyArg_BadArgument("decode", "argument 'encoding'", "str", args[1]);
188 encoding = PyUnicode_AsUTF8AndSize(args[1], &encoding_length);
200 if (!PyUnicode_Check(args[2])) {
201 _PyArg_BadArgument("decode", "argument 'errors'", "str", args[2]);
205 errors = PyUnicode_AsUTF8AndSize(args[2], &errors_length);
233 _codecs_escape_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
242 if (PyUnicode_Check(args[0])) {
244 const char *ptr = PyUnicode_AsUTF8AndSize(args[0], &len);
248 PyBuffer_FillInfo(&data, args[0], (void *)ptr, len, 1, 0);
251 if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
255 _PyArg_BadArgument("escape_decode", "argument 1", "contiguous buffer", args[0]);
262 if (args[1] == Py_None) {
265 else if (PyUnicode_Check(args[1])) {
267 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
277 _PyArg_BadArgument("escape_decode", "argument 2", "str or None", args[1]);
305 _codecs_escape_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
314 if (!PyBytes_Check(args[0])) {
315 _PyArg_BadArgument("escape_encode", "argument 1", "bytes", args[0]);
318 data = args[0];
322 if (args[1] == Py_None) {
325 else if (PyUnicode_Check(args[1])) {
327 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
337 _PyArg_BadArgument("escape_encode", "argument 2", "str or None", args[1]);
360 _codecs_utf_7_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
370 if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
374 _PyArg_BadArgument("utf_7_decode", "argument 1", "contiguous buffer", args[0]);
380 if (args[1] == Py_None) {
383 else if (PyUnicode_Check(args[1])) {
385 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
395 _PyArg_BadArgument("utf_7_decode", "argument 2", "str or None", args[1]);
401 final = _PyLong_AsInt(args[2]);
430 _codecs_utf_8_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
440 if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
444 _PyArg_BadArgument("utf_8_decode", "argument 1", "contiguous buffer", args[0]);
450 if (args[1] == Py_None) {
453 else if (PyUnicode_Check(args[1])) {
455 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
465 _PyArg_BadArgument("utf_8_decode", "argument 2", "str or None", args[1]);
471 final = _PyLong_AsInt(args[2]);
500 _codecs_utf_16_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
510 if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
514 _PyArg_BadArgument("utf_16_decode", "argument 1", "contiguous buffer", args[0]);
520 if (args[1] == Py_None) {
523 else if (PyUnicode_Check(args[1])) {
525 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
535 _PyArg_BadArgument("utf_16_decode", "argument 2", "str or None", args[1]);
541 final = _PyLong_AsInt(args[2]);
570 _codecs_utf_16_le_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
580 if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
584 _PyArg_BadArgument("utf_16_le_decode", "argument 1", "contiguous buffer", args[0]);
590 if (args[1] == Py_None) {
593 else if (PyUnicode_Check(args[1])) {
595 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
605 _PyArg_BadArgument("utf_16_le_decode", "argument 2", "str or None", args[1]);
611 final = _PyLong_AsInt(args[2]);
640 _codecs_utf_16_be_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
650 if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
654 _PyArg_BadArgument("utf_16_be_decode", "argument 1", "contiguous buffer", args[0]);
660 if (args[1] == Py_None) {
663 else if (PyUnicode_Check(args[1])) {
665 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
675 _PyArg_BadArgument("utf_16_be_decode", "argument 2", "str or None", args[1]);
681 final = _PyLong_AsInt(args[2]);
711 _codecs_utf_16_ex_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
722 if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
726 _PyArg_BadArgument("utf_16_ex_decode", "argument 1", "contiguous buffer", args[0]);
732 if (args[1] == Py_None) {
735 else if (PyUnicode_Check(args[1])) {
737 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
747 _PyArg_BadArgument("utf_16_ex_decode", "argument 2", "str or None", args[1]);
753 byteorder = _PyLong_AsInt(args[2]);
760 final = _PyLong_AsInt(args[3]);
789 _codecs_utf_32_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
799 if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
803 _PyArg_BadArgument("utf_32_decode", "argument 1", "contiguous buffer", args[0]);
809 if (args[1] == Py_None) {
812 else if (PyUnicode_Check(args[1])) {
814 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
824 _PyArg_BadArgument("utf_32_decode", "argument 2", "str or None", args[1]);
830 final = _PyLong_AsInt(args[2]);
859 _codecs_utf_32_le_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
869 if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
873 _PyArg_BadArgument("utf_32_le_decode", "argument 1", "contiguous buffer", args[0]);
879 if (args[1] == Py_None) {
882 else if (PyUnicode_Check(args[1])) {
884 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
894 _PyArg_BadArgument("utf_32_le_decode", "argument 2", "str or None", args[1]);
900 final = _PyLong_AsInt(args[2]);
929 _codecs_utf_32_be_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
939 if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
943 _PyArg_BadArgument("utf_32_be_decode", "argument 1", "contiguous buffer", args[0]);
949 if (args[1] == Py_None) {
952 else if (PyUnicode_Check(args[1])) {
954 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
964 _PyArg_BadArgument("utf_32_be_decode", "argument 2", "str or None", args[1]);
970 final = _PyLong_AsInt(args[2]);
1000 _codecs_utf_32_ex_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1011 if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
1015 _PyArg_BadArgument("utf_32_ex_decode", "argument 1", "contiguous buffer", args[0]);
1021 if (args[1] == Py_None) {
1024 else if (PyUnicode_Check(args[1])) {
1026 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
1036 _PyArg_BadArgument("utf_32_ex_decode", "argument 2", "str or None", args[1]);
1042 byteorder = _PyLong_AsInt(args[2]);
1049 final = _PyLong_AsInt(args[3]);
1078 _codecs_unicode_escape_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1088 if (PyUnicode_Check(args[0])) {
1090 const char *ptr = PyUnicode_AsUTF8AndSize(args[0], &len);
1094 PyBuffer_FillInfo(&data, args[0], (void *)ptr, len, 1, 0);
1097 if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
1101 _PyArg_BadArgument("unicode_escape_decode", "argument 1", "contiguous buffer", args[0]);
1108 if (args[1] == Py_None) {
1111 else if (PyUnicode_Check(args[1])) {
1113 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
1123 _PyArg_BadArgument("unicode_escape_decode", "argument 2", "str or None", args[1]);
1129 final = _PyLong_AsInt(args[2]);
1158 _codecs_raw_unicode_escape_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1168 if (PyUnicode_Check(args[0])) {
1170 const char *ptr = PyUnicode_AsUTF8AndSize(args[0], &len);
1174 PyBuffer_FillInfo(&data, args[0], (void *)ptr, len, 1, 0);
1177 if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
1181 _PyArg_BadArgument("raw_unicode_escape_decode", "argument 1", "contiguous buffer", args[0]);
1188 if (args[1] == Py_None) {
1191 else if (PyUnicode_Check(args[1])) {
1193 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
1203 _PyArg_BadArgument("raw_unicode_escape_decode", "argument 2", "str or None", args[1]);
1209 final = _PyLong_AsInt(args[2]);
1238 _codecs_latin_1_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1247 if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
1251 _PyArg_BadArgument("latin_1_decode", "argument 1", "contiguous buffer", args[0]);
1257 if (args[1] == Py_None) {
1260 else if (PyUnicode_Check(args[1])) {
1262 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
1272 _PyArg_BadArgument("latin_1_decode", "argument 2", "str or None", args[1]);
1300 _codecs_ascii_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1309 if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
1313 _PyArg_BadArgument("ascii_decode", "argument 1", "contiguous buffer", args[0]);
1319 if (args[1] == Py_None) {
1322 else if (PyUnicode_Check(args[1])) {
1324 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
1334 _PyArg_BadArgument("ascii_decode", "argument 2", "str or None", args[1]);
1362 _codecs_charmap_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1372 if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
1376 _PyArg_BadArgument("charmap_decode", "argument 1", "contiguous buffer", args[0]);
1382 if (args[1] == Py_None) {
1385 else if (PyUnicode_Check(args[1])) {
1387 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
1397 _PyArg_BadArgument("charmap_decode", "argument 2", "str or None", args[1]);
1403 mapping = args[2];
1431 _codecs_mbcs_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1441 if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
1445 _PyArg_BadArgument("mbcs_decode", "argument 1", "contiguous buffer", args[0]);
1451 if (args[1] == Py_None) {
1454 else if (PyUnicode_Check(args[1])) {
1456 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
1466 _PyArg_BadArgument("mbcs_decode", "argument 2", "str or None", args[1]);
1472 final = _PyLong_AsInt(args[2]);
1505 _codecs_oem_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1515 if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
1519 _PyArg_BadArgument("oem_decode", "argument 1", "contiguous buffer", args[0]);
1525 if (args[1] == Py_None) {
1528 else if (PyUnicode_Check(args[1])) {
1530 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
1540 _PyArg_BadArgument("oem_decode", "argument 2", "str or None", args[1]);
1546 final = _PyLong_AsInt(args[2]);
1579 _codecs_code_page_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1590 codepage = _PyLong_AsInt(args[0]);
1594 if (PyObject_GetBuffer(args[1], &data, PyBUF_SIMPLE) != 0) {
1598 _PyArg_BadArgument("code_page_decode", "argument 2", "contiguous buffer", args[1]);
1604 if (args[2] == Py_None) {
1607 else if (PyUnicode_Check(args[2])) {
1609 errors = PyUnicode_AsUTF8AndSize(args[2], &errors_length);
1619 _PyArg_BadArgument("code_page_decode", "argument 3", "str or None", args[2]);
1625 final = _PyLong_AsInt(args[3]);
1656 _codecs_readbuffer_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1665 if (PyUnicode_Check(args[0])) {
1667 const char *ptr = PyUnicode_AsUTF8AndSize(args[0], &len);
1671 PyBuffer_FillInfo(&data, args[0], (void *)ptr, len, 1, 0);
1674 if (PyObject_GetBuffer(args[0], &data, PyBUF_SIMPLE) != 0) {
1678 _PyArg_BadArgument("readbuffer_encode", "argument 1", "contiguous buffer", args[0]);
1685 if (args[1] == Py_None) {
1688 else if (PyUnicode_Check(args[1])) {
1690 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
1700 _PyArg_BadArgument("readbuffer_encode", "argument 2", "str or None", args[1]);
1728 _codecs_utf_7_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1737 if (!PyUnicode_Check(args[0])) {
1738 _PyArg_BadArgument("utf_7_encode", "argument 1", "str", args[0]);
1741 if (PyUnicode_READY(args[0]) == -1) {
1744 str = args[0];
1748 if (args[1] == Py_None) {
1751 else if (PyUnicode_Check(args[1])) {
1753 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
1763 _PyArg_BadArgument("utf_7_encode", "argument 2", "str or None", args[1]);
1786 _codecs_utf_8_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1795 if (!PyUnicode_Check(args[0])) {
1796 _PyArg_BadArgument("utf_8_encode", "argument 1", "str", args[0]);
1799 if (PyUnicode_READY(args[0]) == -1) {
1802 str = args[0];
1806 if (args[1] == Py_None) {
1809 else if (PyUnicode_Check(args[1])) {
1811 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
1821 _PyArg_BadArgument("utf_8_encode", "argument 2", "str or None", args[1]);
1844 _codecs_utf_16_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1854 if (!PyUnicode_Check(args[0])) {
1855 _PyArg_BadArgument("utf_16_encode", "argument 1", "str", args[0]);
1858 if (PyUnicode_READY(args[0]) == -1) {
1861 str = args[0];
1865 if (args[1] == Py_None) {
1868 else if (PyUnicode_Check(args[1])) {
1870 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
1880 _PyArg_BadArgument("utf_16_encode", "argument 2", "str or None", args[1]);
1886 byteorder = _PyLong_AsInt(args[2]);
1910 _codecs_utf_16_le_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1919 if (!PyUnicode_Check(args[0])) {
1920 _PyArg_BadArgument("utf_16_le_encode", "argument 1", "str", args[0]);
1923 if (PyUnicode_READY(args[0]) == -1) {
1926 str = args[0];
1930 if (args[1] == Py_None) {
1933 else if (PyUnicode_Check(args[1])) {
1935 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
1945 _PyArg_BadArgument("utf_16_le_encode", "argument 2", "str or None", args[1]);
1968 _codecs_utf_16_be_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1977 if (!PyUnicode_Check(args[0])) {
1978 _PyArg_BadArgument("utf_16_be_encode", "argument 1", "str", args[0]);
1981 if (PyUnicode_READY(args[0]) == -1) {
1984 str = args[0];
1988 if (args[1] == Py_None) {
1991 else if (PyUnicode_Check(args[1])) {
1993 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
2003 _PyArg_BadArgument("utf_16_be_encode", "argument 2", "str or None", args[1]);
2026 _codecs_utf_32_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
2036 if (!PyUnicode_Check(args[0])) {
2037 _PyArg_BadArgument("utf_32_encode", "argument 1", "str", args[0]);
2040 if (PyUnicode_READY(args[0]) == -1) {
2043 str = args[0];
2047 if (args[1] == Py_None) {
2050 else if (PyUnicode_Check(args[1])) {
2052 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
2062 _PyArg_BadArgument("utf_32_encode", "argument 2", "str or None", args[1]);
2068 byteorder = _PyLong_AsInt(args[2]);
2092 _codecs_utf_32_le_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
2101 if (!PyUnicode_Check(args[0])) {
2102 _PyArg_BadArgument("utf_32_le_encode", "argument 1", "str", args[0]);
2105 if (PyUnicode_READY(args[0]) == -1) {
2108 str = args[0];
2112 if (args[1] == Py_None) {
2115 else if (PyUnicode_Check(args[1])) {
2117 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
2127 _PyArg_BadArgument("utf_32_le_encode", "argument 2", "str or None", args[1]);
2150 _codecs_utf_32_be_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
2159 if (!PyUnicode_Check(args[0])) {
2160 _PyArg_BadArgument("utf_32_be_encode", "argument 1", "str", args[0]);
2163 if (PyUnicode_READY(args[0]) == -1) {
2166 str = args[0];
2170 if (args[1] == Py_None) {
2173 else if (PyUnicode_Check(args[1])) {
2175 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
2185 _PyArg_BadArgument("utf_32_be_encode", "argument 2", "str or None", args[1]);
2208 _codecs_unicode_escape_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
2217 if (!PyUnicode_Check(args[0])) {
2218 _PyArg_BadArgument("unicode_escape_encode", "argument 1", "str", args[0]);
2221 if (PyUnicode_READY(args[0]) == -1) {
2224 str = args[0];
2228 if (args[1] == Py_None) {
2231 else if (PyUnicode_Check(args[1])) {
2233 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
2243 _PyArg_BadArgument("unicode_escape_encode", "argument 2", "str or None", args[1]);
2266 _codecs_raw_unicode_escape_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
2275 if (!PyUnicode_Check(args[0])) {
2276 _PyArg_BadArgument("raw_unicode_escape_encode", "argument 1", "str", args[0]);
2279 if (PyUnicode_READY(args[0]) == -1) {
2282 str = args[0];
2286 if (args[1] == Py_None) {
2289 else if (PyUnicode_Check(args[1])) {
2291 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
2301 _PyArg_BadArgument("raw_unicode_escape_encode", "argument 2", "str or None", args[1]);
2324 _codecs_latin_1_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
2333 if (!PyUnicode_Check(args[0])) {
2334 _PyArg_BadArgument("latin_1_encode", "argument 1", "str", args[0]);
2337 if (PyUnicode_READY(args[0]) == -1) {
2340 str = args[0];
2344 if (args[1] == Py_None) {
2347 else if (PyUnicode_Check(args[1])) {
2349 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
2359 _PyArg_BadArgument("latin_1_encode", "argument 2", "str or None", args[1]);
2382 _codecs_ascii_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
2391 if (!PyUnicode_Check(args[0])) {
2392 _PyArg_BadArgument("ascii_encode", "argument 1", "str", args[0]);
2395 if (PyUnicode_READY(args[0]) == -1) {
2398 str = args[0];
2402 if (args[1] == Py_None) {
2405 else if (PyUnicode_Check(args[1])) {
2407 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
2417 _PyArg_BadArgument("ascii_encode", "argument 2", "str or None", args[1]);
2440 _codecs_charmap_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
2450 if (!PyUnicode_Check(args[0])) {
2451 _PyArg_BadArgument("charmap_encode", "argument 1", "str", args[0]);
2454 if (PyUnicode_READY(args[0]) == -1) {
2457 str = args[0];
2461 if (args[1] == Py_None) {
2464 else if (PyUnicode_Check(args[1])) {
2466 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
2476 _PyArg_BadArgument("charmap_encode", "argument 2", "str or None", args[1]);
2482 mapping = args[2];
2535 _codecs_mbcs_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
2544 if (!PyUnicode_Check(args[0])) {
2545 _PyArg_BadArgument("mbcs_encode", "argument 1", "str", args[0]);
2548 if (PyUnicode_READY(args[0]) == -1) {
2551 str = args[0];
2555 if (args[1] == Py_None) {
2558 else if (PyUnicode_Check(args[1])) {
2560 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
2570 _PyArg_BadArgument("mbcs_encode", "argument 2", "str or None", args[1]);
2596 _codecs_oem_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
2605 if (!PyUnicode_Check(args[0])) {
2606 _PyArg_BadArgument("oem_encode", "argument 1", "str", args[0]);
2609 if (PyUnicode_READY(args[0]) == -1) {
2612 str = args[0];
2616 if (args[1] == Py_None) {
2619 else if (PyUnicode_Check(args[1])) {
2621 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
2631 _PyArg_BadArgument("oem_encode", "argument 2", "str or None", args[1]);
2658 _codecs_code_page_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
2668 code_page = _PyLong_AsInt(args[0]);
2672 if (!PyUnicode_Check(args[1])) {
2673 _PyArg_BadArgument("code_page_encode", "argument 2", "str", args[1]);
2676 if (PyUnicode_READY(args[1]) == -1) {
2679 str = args[1];
2683 if (args[2] == Py_None) {
2686 else if (PyUnicode_Check(args[2])) {
2688 errors = PyUnicode_AsUTF8AndSize(args[2], &errors_length);
2698 _PyArg_BadArgument("code_page_encode", "argument 3", "str or None", args[2]);
2728 _codecs_register_error(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
2737 if (!PyUnicode_Check(args[0])) {
2738 _PyArg_BadArgument("register_error", "argument 1", "str", args[0]);
2742 errors = PyUnicode_AsUTF8AndSize(args[0], &errors_length);
2750 handler = args[1];