• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4 
5 PyDoc_STRVAR(_codecs_register__doc__,
6 "register($module, search_function, /)\n"
7 "--\n"
8 "\n"
9 "Register a codec search function.\n"
10 "\n"
11 "Search functions are expected to take one argument, the encoding name in\n"
12 "all lower case letters, and either return None, or a tuple of functions\n"
13 "(encoder, decoder, stream_reader, stream_writer) (or a CodecInfo object).");
14 
15 #define _CODECS_REGISTER_METHODDEF    \
16     {"register", (PyCFunction)_codecs_register, METH_O, _codecs_register__doc__},
17 
18 PyDoc_STRVAR(_codecs_lookup__doc__,
19 "lookup($module, encoding, /)\n"
20 "--\n"
21 "\n"
22 "Looks up a codec tuple in the Python codec registry and returns a CodecInfo object.");
23 
24 #define _CODECS_LOOKUP_METHODDEF    \
25     {"lookup", (PyCFunction)_codecs_lookup, METH_O, _codecs_lookup__doc__},
26 
27 static PyObject *
28 _codecs_lookup_impl(PyObject *module, const char *encoding);
29 
30 static PyObject *
_codecs_lookup(PyObject * module,PyObject * arg)31 _codecs_lookup(PyObject *module, PyObject *arg)
32 {
33     PyObject *return_value = NULL;
34     const char *encoding;
35 
36     if (!PyArg_Parse(arg, "s:lookup", &encoding)) {
37         goto exit;
38     }
39     return_value = _codecs_lookup_impl(module, encoding);
40 
41 exit:
42     return return_value;
43 }
44 
45 PyDoc_STRVAR(_codecs_encode__doc__,
46 "encode($module, /, obj, encoding=\'utf-8\', errors=\'strict\')\n"
47 "--\n"
48 "\n"
49 "Encodes obj using the codec registered for encoding.\n"
50 "\n"
51 "The default encoding is \'utf-8\'.  errors may be given to set a\n"
52 "different error handling scheme.  Default is \'strict\' meaning that encoding\n"
53 "errors raise a ValueError.  Other possible values are \'ignore\', \'replace\'\n"
54 "and \'backslashreplace\' as well as any other name registered with\n"
55 "codecs.register_error that can handle ValueErrors.");
56 
57 #define _CODECS_ENCODE_METHODDEF    \
58     {"encode", (PyCFunction)_codecs_encode, METH_FASTCALL|METH_KEYWORDS, _codecs_encode__doc__},
59 
60 static PyObject *
61 _codecs_encode_impl(PyObject *module, PyObject *obj, const char *encoding,
62                     const char *errors);
63 
64 static PyObject *
_codecs_encode(PyObject * module,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)65 _codecs_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
66 {
67     PyObject *return_value = NULL;
68     static const char * const _keywords[] = {"obj", "encoding", "errors", NULL};
69     static _PyArg_Parser _parser = {"O|ss:encode", _keywords, 0};
70     PyObject *obj;
71     const char *encoding = NULL;
72     const char *errors = NULL;
73 
74     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
75         &obj, &encoding, &errors)) {
76         goto exit;
77     }
78     return_value = _codecs_encode_impl(module, obj, encoding, errors);
79 
80 exit:
81     return return_value;
82 }
83 
84 PyDoc_STRVAR(_codecs_decode__doc__,
85 "decode($module, /, obj, encoding=\'utf-8\', errors=\'strict\')\n"
86 "--\n"
87 "\n"
88 "Decodes obj using the codec registered for encoding.\n"
89 "\n"
90 "Default encoding is \'utf-8\'.  errors may be given to set a\n"
91 "different error handling scheme.  Default is \'strict\' meaning that encoding\n"
92 "errors raise a ValueError.  Other possible values are \'ignore\', \'replace\'\n"
93 "and \'backslashreplace\' as well as any other name registered with\n"
94 "codecs.register_error that can handle ValueErrors.");
95 
96 #define _CODECS_DECODE_METHODDEF    \
97     {"decode", (PyCFunction)_codecs_decode, METH_FASTCALL|METH_KEYWORDS, _codecs_decode__doc__},
98 
99 static PyObject *
100 _codecs_decode_impl(PyObject *module, PyObject *obj, const char *encoding,
101                     const char *errors);
102 
103 static PyObject *
_codecs_decode(PyObject * module,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)104 _codecs_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
105 {
106     PyObject *return_value = NULL;
107     static const char * const _keywords[] = {"obj", "encoding", "errors", NULL};
108     static _PyArg_Parser _parser = {"O|ss:decode", _keywords, 0};
109     PyObject *obj;
110     const char *encoding = NULL;
111     const char *errors = NULL;
112 
113     if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
114         &obj, &encoding, &errors)) {
115         goto exit;
116     }
117     return_value = _codecs_decode_impl(module, obj, encoding, errors);
118 
119 exit:
120     return return_value;
121 }
122 
123 PyDoc_STRVAR(_codecs__forget_codec__doc__,
124 "_forget_codec($module, encoding, /)\n"
125 "--\n"
126 "\n"
127 "Purge the named codec from the internal codec lookup cache");
128 
129 #define _CODECS__FORGET_CODEC_METHODDEF    \
130     {"_forget_codec", (PyCFunction)_codecs__forget_codec, METH_O, _codecs__forget_codec__doc__},
131 
132 static PyObject *
133 _codecs__forget_codec_impl(PyObject *module, const char *encoding);
134 
135 static PyObject *
_codecs__forget_codec(PyObject * module,PyObject * arg)136 _codecs__forget_codec(PyObject *module, PyObject *arg)
137 {
138     PyObject *return_value = NULL;
139     const char *encoding;
140 
141     if (!PyArg_Parse(arg, "s:_forget_codec", &encoding)) {
142         goto exit;
143     }
144     return_value = _codecs__forget_codec_impl(module, encoding);
145 
146 exit:
147     return return_value;
148 }
149 
150 PyDoc_STRVAR(_codecs_escape_decode__doc__,
151 "escape_decode($module, data, errors=None, /)\n"
152 "--\n"
153 "\n");
154 
155 #define _CODECS_ESCAPE_DECODE_METHODDEF    \
156     {"escape_decode", (PyCFunction)_codecs_escape_decode, METH_FASTCALL, _codecs_escape_decode__doc__},
157 
158 static PyObject *
159 _codecs_escape_decode_impl(PyObject *module, Py_buffer *data,
160                            const char *errors);
161 
162 static PyObject *
_codecs_escape_decode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)163 _codecs_escape_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
164 {
165     PyObject *return_value = NULL;
166     Py_buffer data = {NULL, NULL};
167     const char *errors = NULL;
168 
169     if (!_PyArg_ParseStack(args, nargs, "s*|z:escape_decode",
170         &data, &errors)) {
171         goto exit;
172     }
173     return_value = _codecs_escape_decode_impl(module, &data, errors);
174 
175 exit:
176     /* Cleanup for data */
177     if (data.obj) {
178        PyBuffer_Release(&data);
179     }
180 
181     return return_value;
182 }
183 
184 PyDoc_STRVAR(_codecs_escape_encode__doc__,
185 "escape_encode($module, data, errors=None, /)\n"
186 "--\n"
187 "\n");
188 
189 #define _CODECS_ESCAPE_ENCODE_METHODDEF    \
190     {"escape_encode", (PyCFunction)_codecs_escape_encode, METH_FASTCALL, _codecs_escape_encode__doc__},
191 
192 static PyObject *
193 _codecs_escape_encode_impl(PyObject *module, PyObject *data,
194                            const char *errors);
195 
196 static PyObject *
_codecs_escape_encode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)197 _codecs_escape_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
198 {
199     PyObject *return_value = NULL;
200     PyObject *data;
201     const char *errors = NULL;
202 
203     if (!_PyArg_ParseStack(args, nargs, "O!|z:escape_encode",
204         &PyBytes_Type, &data, &errors)) {
205         goto exit;
206     }
207     return_value = _codecs_escape_encode_impl(module, data, errors);
208 
209 exit:
210     return return_value;
211 }
212 
213 PyDoc_STRVAR(_codecs_unicode_internal_decode__doc__,
214 "unicode_internal_decode($module, obj, errors=None, /)\n"
215 "--\n"
216 "\n");
217 
218 #define _CODECS_UNICODE_INTERNAL_DECODE_METHODDEF    \
219     {"unicode_internal_decode", (PyCFunction)_codecs_unicode_internal_decode, METH_FASTCALL, _codecs_unicode_internal_decode__doc__},
220 
221 static PyObject *
222 _codecs_unicode_internal_decode_impl(PyObject *module, PyObject *obj,
223                                      const char *errors);
224 
225 static PyObject *
_codecs_unicode_internal_decode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)226 _codecs_unicode_internal_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
227 {
228     PyObject *return_value = NULL;
229     PyObject *obj;
230     const char *errors = NULL;
231 
232     if (!_PyArg_ParseStack(args, nargs, "O|z:unicode_internal_decode",
233         &obj, &errors)) {
234         goto exit;
235     }
236     return_value = _codecs_unicode_internal_decode_impl(module, obj, errors);
237 
238 exit:
239     return return_value;
240 }
241 
242 PyDoc_STRVAR(_codecs_utf_7_decode__doc__,
243 "utf_7_decode($module, data, errors=None, final=False, /)\n"
244 "--\n"
245 "\n");
246 
247 #define _CODECS_UTF_7_DECODE_METHODDEF    \
248     {"utf_7_decode", (PyCFunction)_codecs_utf_7_decode, METH_FASTCALL, _codecs_utf_7_decode__doc__},
249 
250 static PyObject *
251 _codecs_utf_7_decode_impl(PyObject *module, Py_buffer *data,
252                           const char *errors, int final);
253 
254 static PyObject *
_codecs_utf_7_decode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)255 _codecs_utf_7_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
256 {
257     PyObject *return_value = NULL;
258     Py_buffer data = {NULL, NULL};
259     const char *errors = NULL;
260     int final = 0;
261 
262     if (!_PyArg_ParseStack(args, nargs, "y*|zi:utf_7_decode",
263         &data, &errors, &final)) {
264         goto exit;
265     }
266     return_value = _codecs_utf_7_decode_impl(module, &data, errors, final);
267 
268 exit:
269     /* Cleanup for data */
270     if (data.obj) {
271        PyBuffer_Release(&data);
272     }
273 
274     return return_value;
275 }
276 
277 PyDoc_STRVAR(_codecs_utf_8_decode__doc__,
278 "utf_8_decode($module, data, errors=None, final=False, /)\n"
279 "--\n"
280 "\n");
281 
282 #define _CODECS_UTF_8_DECODE_METHODDEF    \
283     {"utf_8_decode", (PyCFunction)_codecs_utf_8_decode, METH_FASTCALL, _codecs_utf_8_decode__doc__},
284 
285 static PyObject *
286 _codecs_utf_8_decode_impl(PyObject *module, Py_buffer *data,
287                           const char *errors, int final);
288 
289 static PyObject *
_codecs_utf_8_decode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)290 _codecs_utf_8_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
291 {
292     PyObject *return_value = NULL;
293     Py_buffer data = {NULL, NULL};
294     const char *errors = NULL;
295     int final = 0;
296 
297     if (!_PyArg_ParseStack(args, nargs, "y*|zi:utf_8_decode",
298         &data, &errors, &final)) {
299         goto exit;
300     }
301     return_value = _codecs_utf_8_decode_impl(module, &data, errors, final);
302 
303 exit:
304     /* Cleanup for data */
305     if (data.obj) {
306        PyBuffer_Release(&data);
307     }
308 
309     return return_value;
310 }
311 
312 PyDoc_STRVAR(_codecs_utf_16_decode__doc__,
313 "utf_16_decode($module, data, errors=None, final=False, /)\n"
314 "--\n"
315 "\n");
316 
317 #define _CODECS_UTF_16_DECODE_METHODDEF    \
318     {"utf_16_decode", (PyCFunction)_codecs_utf_16_decode, METH_FASTCALL, _codecs_utf_16_decode__doc__},
319 
320 static PyObject *
321 _codecs_utf_16_decode_impl(PyObject *module, Py_buffer *data,
322                            const char *errors, int final);
323 
324 static PyObject *
_codecs_utf_16_decode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)325 _codecs_utf_16_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
326 {
327     PyObject *return_value = NULL;
328     Py_buffer data = {NULL, NULL};
329     const char *errors = NULL;
330     int final = 0;
331 
332     if (!_PyArg_ParseStack(args, nargs, "y*|zi:utf_16_decode",
333         &data, &errors, &final)) {
334         goto exit;
335     }
336     return_value = _codecs_utf_16_decode_impl(module, &data, errors, final);
337 
338 exit:
339     /* Cleanup for data */
340     if (data.obj) {
341        PyBuffer_Release(&data);
342     }
343 
344     return return_value;
345 }
346 
347 PyDoc_STRVAR(_codecs_utf_16_le_decode__doc__,
348 "utf_16_le_decode($module, data, errors=None, final=False, /)\n"
349 "--\n"
350 "\n");
351 
352 #define _CODECS_UTF_16_LE_DECODE_METHODDEF    \
353     {"utf_16_le_decode", (PyCFunction)_codecs_utf_16_le_decode, METH_FASTCALL, _codecs_utf_16_le_decode__doc__},
354 
355 static PyObject *
356 _codecs_utf_16_le_decode_impl(PyObject *module, Py_buffer *data,
357                               const char *errors, int final);
358 
359 static PyObject *
_codecs_utf_16_le_decode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)360 _codecs_utf_16_le_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
361 {
362     PyObject *return_value = NULL;
363     Py_buffer data = {NULL, NULL};
364     const char *errors = NULL;
365     int final = 0;
366 
367     if (!_PyArg_ParseStack(args, nargs, "y*|zi:utf_16_le_decode",
368         &data, &errors, &final)) {
369         goto exit;
370     }
371     return_value = _codecs_utf_16_le_decode_impl(module, &data, errors, final);
372 
373 exit:
374     /* Cleanup for data */
375     if (data.obj) {
376        PyBuffer_Release(&data);
377     }
378 
379     return return_value;
380 }
381 
382 PyDoc_STRVAR(_codecs_utf_16_be_decode__doc__,
383 "utf_16_be_decode($module, data, errors=None, final=False, /)\n"
384 "--\n"
385 "\n");
386 
387 #define _CODECS_UTF_16_BE_DECODE_METHODDEF    \
388     {"utf_16_be_decode", (PyCFunction)_codecs_utf_16_be_decode, METH_FASTCALL, _codecs_utf_16_be_decode__doc__},
389 
390 static PyObject *
391 _codecs_utf_16_be_decode_impl(PyObject *module, Py_buffer *data,
392                               const char *errors, int final);
393 
394 static PyObject *
_codecs_utf_16_be_decode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)395 _codecs_utf_16_be_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
396 {
397     PyObject *return_value = NULL;
398     Py_buffer data = {NULL, NULL};
399     const char *errors = NULL;
400     int final = 0;
401 
402     if (!_PyArg_ParseStack(args, nargs, "y*|zi:utf_16_be_decode",
403         &data, &errors, &final)) {
404         goto exit;
405     }
406     return_value = _codecs_utf_16_be_decode_impl(module, &data, errors, final);
407 
408 exit:
409     /* Cleanup for data */
410     if (data.obj) {
411        PyBuffer_Release(&data);
412     }
413 
414     return return_value;
415 }
416 
417 PyDoc_STRVAR(_codecs_utf_16_ex_decode__doc__,
418 "utf_16_ex_decode($module, data, errors=None, byteorder=0, final=False,\n"
419 "                 /)\n"
420 "--\n"
421 "\n");
422 
423 #define _CODECS_UTF_16_EX_DECODE_METHODDEF    \
424     {"utf_16_ex_decode", (PyCFunction)_codecs_utf_16_ex_decode, METH_FASTCALL, _codecs_utf_16_ex_decode__doc__},
425 
426 static PyObject *
427 _codecs_utf_16_ex_decode_impl(PyObject *module, Py_buffer *data,
428                               const char *errors, int byteorder, int final);
429 
430 static PyObject *
_codecs_utf_16_ex_decode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)431 _codecs_utf_16_ex_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
432 {
433     PyObject *return_value = NULL;
434     Py_buffer data = {NULL, NULL};
435     const char *errors = NULL;
436     int byteorder = 0;
437     int final = 0;
438 
439     if (!_PyArg_ParseStack(args, nargs, "y*|zii:utf_16_ex_decode",
440         &data, &errors, &byteorder, &final)) {
441         goto exit;
442     }
443     return_value = _codecs_utf_16_ex_decode_impl(module, &data, errors, byteorder, final);
444 
445 exit:
446     /* Cleanup for data */
447     if (data.obj) {
448        PyBuffer_Release(&data);
449     }
450 
451     return return_value;
452 }
453 
454 PyDoc_STRVAR(_codecs_utf_32_decode__doc__,
455 "utf_32_decode($module, data, errors=None, final=False, /)\n"
456 "--\n"
457 "\n");
458 
459 #define _CODECS_UTF_32_DECODE_METHODDEF    \
460     {"utf_32_decode", (PyCFunction)_codecs_utf_32_decode, METH_FASTCALL, _codecs_utf_32_decode__doc__},
461 
462 static PyObject *
463 _codecs_utf_32_decode_impl(PyObject *module, Py_buffer *data,
464                            const char *errors, int final);
465 
466 static PyObject *
_codecs_utf_32_decode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)467 _codecs_utf_32_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
468 {
469     PyObject *return_value = NULL;
470     Py_buffer data = {NULL, NULL};
471     const char *errors = NULL;
472     int final = 0;
473 
474     if (!_PyArg_ParseStack(args, nargs, "y*|zi:utf_32_decode",
475         &data, &errors, &final)) {
476         goto exit;
477     }
478     return_value = _codecs_utf_32_decode_impl(module, &data, errors, final);
479 
480 exit:
481     /* Cleanup for data */
482     if (data.obj) {
483        PyBuffer_Release(&data);
484     }
485 
486     return return_value;
487 }
488 
489 PyDoc_STRVAR(_codecs_utf_32_le_decode__doc__,
490 "utf_32_le_decode($module, data, errors=None, final=False, /)\n"
491 "--\n"
492 "\n");
493 
494 #define _CODECS_UTF_32_LE_DECODE_METHODDEF    \
495     {"utf_32_le_decode", (PyCFunction)_codecs_utf_32_le_decode, METH_FASTCALL, _codecs_utf_32_le_decode__doc__},
496 
497 static PyObject *
498 _codecs_utf_32_le_decode_impl(PyObject *module, Py_buffer *data,
499                               const char *errors, int final);
500 
501 static PyObject *
_codecs_utf_32_le_decode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)502 _codecs_utf_32_le_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
503 {
504     PyObject *return_value = NULL;
505     Py_buffer data = {NULL, NULL};
506     const char *errors = NULL;
507     int final = 0;
508 
509     if (!_PyArg_ParseStack(args, nargs, "y*|zi:utf_32_le_decode",
510         &data, &errors, &final)) {
511         goto exit;
512     }
513     return_value = _codecs_utf_32_le_decode_impl(module, &data, errors, final);
514 
515 exit:
516     /* Cleanup for data */
517     if (data.obj) {
518        PyBuffer_Release(&data);
519     }
520 
521     return return_value;
522 }
523 
524 PyDoc_STRVAR(_codecs_utf_32_be_decode__doc__,
525 "utf_32_be_decode($module, data, errors=None, final=False, /)\n"
526 "--\n"
527 "\n");
528 
529 #define _CODECS_UTF_32_BE_DECODE_METHODDEF    \
530     {"utf_32_be_decode", (PyCFunction)_codecs_utf_32_be_decode, METH_FASTCALL, _codecs_utf_32_be_decode__doc__},
531 
532 static PyObject *
533 _codecs_utf_32_be_decode_impl(PyObject *module, Py_buffer *data,
534                               const char *errors, int final);
535 
536 static PyObject *
_codecs_utf_32_be_decode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)537 _codecs_utf_32_be_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
538 {
539     PyObject *return_value = NULL;
540     Py_buffer data = {NULL, NULL};
541     const char *errors = NULL;
542     int final = 0;
543 
544     if (!_PyArg_ParseStack(args, nargs, "y*|zi:utf_32_be_decode",
545         &data, &errors, &final)) {
546         goto exit;
547     }
548     return_value = _codecs_utf_32_be_decode_impl(module, &data, errors, final);
549 
550 exit:
551     /* Cleanup for data */
552     if (data.obj) {
553        PyBuffer_Release(&data);
554     }
555 
556     return return_value;
557 }
558 
559 PyDoc_STRVAR(_codecs_utf_32_ex_decode__doc__,
560 "utf_32_ex_decode($module, data, errors=None, byteorder=0, final=False,\n"
561 "                 /)\n"
562 "--\n"
563 "\n");
564 
565 #define _CODECS_UTF_32_EX_DECODE_METHODDEF    \
566     {"utf_32_ex_decode", (PyCFunction)_codecs_utf_32_ex_decode, METH_FASTCALL, _codecs_utf_32_ex_decode__doc__},
567 
568 static PyObject *
569 _codecs_utf_32_ex_decode_impl(PyObject *module, Py_buffer *data,
570                               const char *errors, int byteorder, int final);
571 
572 static PyObject *
_codecs_utf_32_ex_decode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)573 _codecs_utf_32_ex_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
574 {
575     PyObject *return_value = NULL;
576     Py_buffer data = {NULL, NULL};
577     const char *errors = NULL;
578     int byteorder = 0;
579     int final = 0;
580 
581     if (!_PyArg_ParseStack(args, nargs, "y*|zii:utf_32_ex_decode",
582         &data, &errors, &byteorder, &final)) {
583         goto exit;
584     }
585     return_value = _codecs_utf_32_ex_decode_impl(module, &data, errors, byteorder, final);
586 
587 exit:
588     /* Cleanup for data */
589     if (data.obj) {
590        PyBuffer_Release(&data);
591     }
592 
593     return return_value;
594 }
595 
596 PyDoc_STRVAR(_codecs_unicode_escape_decode__doc__,
597 "unicode_escape_decode($module, data, errors=None, /)\n"
598 "--\n"
599 "\n");
600 
601 #define _CODECS_UNICODE_ESCAPE_DECODE_METHODDEF    \
602     {"unicode_escape_decode", (PyCFunction)_codecs_unicode_escape_decode, METH_FASTCALL, _codecs_unicode_escape_decode__doc__},
603 
604 static PyObject *
605 _codecs_unicode_escape_decode_impl(PyObject *module, Py_buffer *data,
606                                    const char *errors);
607 
608 static PyObject *
_codecs_unicode_escape_decode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)609 _codecs_unicode_escape_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
610 {
611     PyObject *return_value = NULL;
612     Py_buffer data = {NULL, NULL};
613     const char *errors = NULL;
614 
615     if (!_PyArg_ParseStack(args, nargs, "s*|z:unicode_escape_decode",
616         &data, &errors)) {
617         goto exit;
618     }
619     return_value = _codecs_unicode_escape_decode_impl(module, &data, errors);
620 
621 exit:
622     /* Cleanup for data */
623     if (data.obj) {
624        PyBuffer_Release(&data);
625     }
626 
627     return return_value;
628 }
629 
630 PyDoc_STRVAR(_codecs_raw_unicode_escape_decode__doc__,
631 "raw_unicode_escape_decode($module, data, errors=None, /)\n"
632 "--\n"
633 "\n");
634 
635 #define _CODECS_RAW_UNICODE_ESCAPE_DECODE_METHODDEF    \
636     {"raw_unicode_escape_decode", (PyCFunction)_codecs_raw_unicode_escape_decode, METH_FASTCALL, _codecs_raw_unicode_escape_decode__doc__},
637 
638 static PyObject *
639 _codecs_raw_unicode_escape_decode_impl(PyObject *module, Py_buffer *data,
640                                        const char *errors);
641 
642 static PyObject *
_codecs_raw_unicode_escape_decode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)643 _codecs_raw_unicode_escape_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
644 {
645     PyObject *return_value = NULL;
646     Py_buffer data = {NULL, NULL};
647     const char *errors = NULL;
648 
649     if (!_PyArg_ParseStack(args, nargs, "s*|z:raw_unicode_escape_decode",
650         &data, &errors)) {
651         goto exit;
652     }
653     return_value = _codecs_raw_unicode_escape_decode_impl(module, &data, errors);
654 
655 exit:
656     /* Cleanup for data */
657     if (data.obj) {
658        PyBuffer_Release(&data);
659     }
660 
661     return return_value;
662 }
663 
664 PyDoc_STRVAR(_codecs_latin_1_decode__doc__,
665 "latin_1_decode($module, data, errors=None, /)\n"
666 "--\n"
667 "\n");
668 
669 #define _CODECS_LATIN_1_DECODE_METHODDEF    \
670     {"latin_1_decode", (PyCFunction)_codecs_latin_1_decode, METH_FASTCALL, _codecs_latin_1_decode__doc__},
671 
672 static PyObject *
673 _codecs_latin_1_decode_impl(PyObject *module, Py_buffer *data,
674                             const char *errors);
675 
676 static PyObject *
_codecs_latin_1_decode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)677 _codecs_latin_1_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
678 {
679     PyObject *return_value = NULL;
680     Py_buffer data = {NULL, NULL};
681     const char *errors = NULL;
682 
683     if (!_PyArg_ParseStack(args, nargs, "y*|z:latin_1_decode",
684         &data, &errors)) {
685         goto exit;
686     }
687     return_value = _codecs_latin_1_decode_impl(module, &data, errors);
688 
689 exit:
690     /* Cleanup for data */
691     if (data.obj) {
692        PyBuffer_Release(&data);
693     }
694 
695     return return_value;
696 }
697 
698 PyDoc_STRVAR(_codecs_ascii_decode__doc__,
699 "ascii_decode($module, data, errors=None, /)\n"
700 "--\n"
701 "\n");
702 
703 #define _CODECS_ASCII_DECODE_METHODDEF    \
704     {"ascii_decode", (PyCFunction)_codecs_ascii_decode, METH_FASTCALL, _codecs_ascii_decode__doc__},
705 
706 static PyObject *
707 _codecs_ascii_decode_impl(PyObject *module, Py_buffer *data,
708                           const char *errors);
709 
710 static PyObject *
_codecs_ascii_decode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)711 _codecs_ascii_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
712 {
713     PyObject *return_value = NULL;
714     Py_buffer data = {NULL, NULL};
715     const char *errors = NULL;
716 
717     if (!_PyArg_ParseStack(args, nargs, "y*|z:ascii_decode",
718         &data, &errors)) {
719         goto exit;
720     }
721     return_value = _codecs_ascii_decode_impl(module, &data, errors);
722 
723 exit:
724     /* Cleanup for data */
725     if (data.obj) {
726        PyBuffer_Release(&data);
727     }
728 
729     return return_value;
730 }
731 
732 PyDoc_STRVAR(_codecs_charmap_decode__doc__,
733 "charmap_decode($module, data, errors=None, mapping=None, /)\n"
734 "--\n"
735 "\n");
736 
737 #define _CODECS_CHARMAP_DECODE_METHODDEF    \
738     {"charmap_decode", (PyCFunction)_codecs_charmap_decode, METH_FASTCALL, _codecs_charmap_decode__doc__},
739 
740 static PyObject *
741 _codecs_charmap_decode_impl(PyObject *module, Py_buffer *data,
742                             const char *errors, PyObject *mapping);
743 
744 static PyObject *
_codecs_charmap_decode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)745 _codecs_charmap_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
746 {
747     PyObject *return_value = NULL;
748     Py_buffer data = {NULL, NULL};
749     const char *errors = NULL;
750     PyObject *mapping = NULL;
751 
752     if (!_PyArg_ParseStack(args, nargs, "y*|zO:charmap_decode",
753         &data, &errors, &mapping)) {
754         goto exit;
755     }
756     return_value = _codecs_charmap_decode_impl(module, &data, errors, mapping);
757 
758 exit:
759     /* Cleanup for data */
760     if (data.obj) {
761        PyBuffer_Release(&data);
762     }
763 
764     return return_value;
765 }
766 
767 #if defined(MS_WINDOWS)
768 
769 PyDoc_STRVAR(_codecs_mbcs_decode__doc__,
770 "mbcs_decode($module, data, errors=None, final=False, /)\n"
771 "--\n"
772 "\n");
773 
774 #define _CODECS_MBCS_DECODE_METHODDEF    \
775     {"mbcs_decode", (PyCFunction)_codecs_mbcs_decode, METH_FASTCALL, _codecs_mbcs_decode__doc__},
776 
777 static PyObject *
778 _codecs_mbcs_decode_impl(PyObject *module, Py_buffer *data,
779                          const char *errors, int final);
780 
781 static PyObject *
_codecs_mbcs_decode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)782 _codecs_mbcs_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
783 {
784     PyObject *return_value = NULL;
785     Py_buffer data = {NULL, NULL};
786     const char *errors = NULL;
787     int final = 0;
788 
789     if (!_PyArg_ParseStack(args, nargs, "y*|zi:mbcs_decode",
790         &data, &errors, &final)) {
791         goto exit;
792     }
793     return_value = _codecs_mbcs_decode_impl(module, &data, errors, final);
794 
795 exit:
796     /* Cleanup for data */
797     if (data.obj) {
798        PyBuffer_Release(&data);
799     }
800 
801     return return_value;
802 }
803 
804 #endif /* defined(MS_WINDOWS) */
805 
806 #if defined(MS_WINDOWS)
807 
808 PyDoc_STRVAR(_codecs_oem_decode__doc__,
809 "oem_decode($module, data, errors=None, final=False, /)\n"
810 "--\n"
811 "\n");
812 
813 #define _CODECS_OEM_DECODE_METHODDEF    \
814     {"oem_decode", (PyCFunction)_codecs_oem_decode, METH_FASTCALL, _codecs_oem_decode__doc__},
815 
816 static PyObject *
817 _codecs_oem_decode_impl(PyObject *module, Py_buffer *data,
818                         const char *errors, int final);
819 
820 static PyObject *
_codecs_oem_decode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)821 _codecs_oem_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
822 {
823     PyObject *return_value = NULL;
824     Py_buffer data = {NULL, NULL};
825     const char *errors = NULL;
826     int final = 0;
827 
828     if (!_PyArg_ParseStack(args, nargs, "y*|zi:oem_decode",
829         &data, &errors, &final)) {
830         goto exit;
831     }
832     return_value = _codecs_oem_decode_impl(module, &data, errors, final);
833 
834 exit:
835     /* Cleanup for data */
836     if (data.obj) {
837        PyBuffer_Release(&data);
838     }
839 
840     return return_value;
841 }
842 
843 #endif /* defined(MS_WINDOWS) */
844 
845 #if defined(MS_WINDOWS)
846 
847 PyDoc_STRVAR(_codecs_code_page_decode__doc__,
848 "code_page_decode($module, codepage, data, errors=None, final=False, /)\n"
849 "--\n"
850 "\n");
851 
852 #define _CODECS_CODE_PAGE_DECODE_METHODDEF    \
853     {"code_page_decode", (PyCFunction)_codecs_code_page_decode, METH_FASTCALL, _codecs_code_page_decode__doc__},
854 
855 static PyObject *
856 _codecs_code_page_decode_impl(PyObject *module, int codepage,
857                               Py_buffer *data, const char *errors, int final);
858 
859 static PyObject *
_codecs_code_page_decode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)860 _codecs_code_page_decode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
861 {
862     PyObject *return_value = NULL;
863     int codepage;
864     Py_buffer data = {NULL, NULL};
865     const char *errors = NULL;
866     int final = 0;
867 
868     if (!_PyArg_ParseStack(args, nargs, "iy*|zi:code_page_decode",
869         &codepage, &data, &errors, &final)) {
870         goto exit;
871     }
872     return_value = _codecs_code_page_decode_impl(module, codepage, &data, errors, final);
873 
874 exit:
875     /* Cleanup for data */
876     if (data.obj) {
877        PyBuffer_Release(&data);
878     }
879 
880     return return_value;
881 }
882 
883 #endif /* defined(MS_WINDOWS) */
884 
885 PyDoc_STRVAR(_codecs_readbuffer_encode__doc__,
886 "readbuffer_encode($module, data, errors=None, /)\n"
887 "--\n"
888 "\n");
889 
890 #define _CODECS_READBUFFER_ENCODE_METHODDEF    \
891     {"readbuffer_encode", (PyCFunction)_codecs_readbuffer_encode, METH_FASTCALL, _codecs_readbuffer_encode__doc__},
892 
893 static PyObject *
894 _codecs_readbuffer_encode_impl(PyObject *module, Py_buffer *data,
895                                const char *errors);
896 
897 static PyObject *
_codecs_readbuffer_encode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)898 _codecs_readbuffer_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
899 {
900     PyObject *return_value = NULL;
901     Py_buffer data = {NULL, NULL};
902     const char *errors = NULL;
903 
904     if (!_PyArg_ParseStack(args, nargs, "s*|z:readbuffer_encode",
905         &data, &errors)) {
906         goto exit;
907     }
908     return_value = _codecs_readbuffer_encode_impl(module, &data, errors);
909 
910 exit:
911     /* Cleanup for data */
912     if (data.obj) {
913        PyBuffer_Release(&data);
914     }
915 
916     return return_value;
917 }
918 
919 PyDoc_STRVAR(_codecs_unicode_internal_encode__doc__,
920 "unicode_internal_encode($module, obj, errors=None, /)\n"
921 "--\n"
922 "\n");
923 
924 #define _CODECS_UNICODE_INTERNAL_ENCODE_METHODDEF    \
925     {"unicode_internal_encode", (PyCFunction)_codecs_unicode_internal_encode, METH_FASTCALL, _codecs_unicode_internal_encode__doc__},
926 
927 static PyObject *
928 _codecs_unicode_internal_encode_impl(PyObject *module, PyObject *obj,
929                                      const char *errors);
930 
931 static PyObject *
_codecs_unicode_internal_encode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)932 _codecs_unicode_internal_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
933 {
934     PyObject *return_value = NULL;
935     PyObject *obj;
936     const char *errors = NULL;
937 
938     if (!_PyArg_ParseStack(args, nargs, "O|z:unicode_internal_encode",
939         &obj, &errors)) {
940         goto exit;
941     }
942     return_value = _codecs_unicode_internal_encode_impl(module, obj, errors);
943 
944 exit:
945     return return_value;
946 }
947 
948 PyDoc_STRVAR(_codecs_utf_7_encode__doc__,
949 "utf_7_encode($module, str, errors=None, /)\n"
950 "--\n"
951 "\n");
952 
953 #define _CODECS_UTF_7_ENCODE_METHODDEF    \
954     {"utf_7_encode", (PyCFunction)_codecs_utf_7_encode, METH_FASTCALL, _codecs_utf_7_encode__doc__},
955 
956 static PyObject *
957 _codecs_utf_7_encode_impl(PyObject *module, PyObject *str,
958                           const char *errors);
959 
960 static PyObject *
_codecs_utf_7_encode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)961 _codecs_utf_7_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
962 {
963     PyObject *return_value = NULL;
964     PyObject *str;
965     const char *errors = NULL;
966 
967     if (!_PyArg_ParseStack(args, nargs, "U|z:utf_7_encode",
968         &str, &errors)) {
969         goto exit;
970     }
971     return_value = _codecs_utf_7_encode_impl(module, str, errors);
972 
973 exit:
974     return return_value;
975 }
976 
977 PyDoc_STRVAR(_codecs_utf_8_encode__doc__,
978 "utf_8_encode($module, str, errors=None, /)\n"
979 "--\n"
980 "\n");
981 
982 #define _CODECS_UTF_8_ENCODE_METHODDEF    \
983     {"utf_8_encode", (PyCFunction)_codecs_utf_8_encode, METH_FASTCALL, _codecs_utf_8_encode__doc__},
984 
985 static PyObject *
986 _codecs_utf_8_encode_impl(PyObject *module, PyObject *str,
987                           const char *errors);
988 
989 static PyObject *
_codecs_utf_8_encode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)990 _codecs_utf_8_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
991 {
992     PyObject *return_value = NULL;
993     PyObject *str;
994     const char *errors = NULL;
995 
996     if (!_PyArg_ParseStack(args, nargs, "U|z:utf_8_encode",
997         &str, &errors)) {
998         goto exit;
999     }
1000     return_value = _codecs_utf_8_encode_impl(module, str, errors);
1001 
1002 exit:
1003     return return_value;
1004 }
1005 
1006 PyDoc_STRVAR(_codecs_utf_16_encode__doc__,
1007 "utf_16_encode($module, str, errors=None, byteorder=0, /)\n"
1008 "--\n"
1009 "\n");
1010 
1011 #define _CODECS_UTF_16_ENCODE_METHODDEF    \
1012     {"utf_16_encode", (PyCFunction)_codecs_utf_16_encode, METH_FASTCALL, _codecs_utf_16_encode__doc__},
1013 
1014 static PyObject *
1015 _codecs_utf_16_encode_impl(PyObject *module, PyObject *str,
1016                            const char *errors, int byteorder);
1017 
1018 static PyObject *
_codecs_utf_16_encode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1019 _codecs_utf_16_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1020 {
1021     PyObject *return_value = NULL;
1022     PyObject *str;
1023     const char *errors = NULL;
1024     int byteorder = 0;
1025 
1026     if (!_PyArg_ParseStack(args, nargs, "U|zi:utf_16_encode",
1027         &str, &errors, &byteorder)) {
1028         goto exit;
1029     }
1030     return_value = _codecs_utf_16_encode_impl(module, str, errors, byteorder);
1031 
1032 exit:
1033     return return_value;
1034 }
1035 
1036 PyDoc_STRVAR(_codecs_utf_16_le_encode__doc__,
1037 "utf_16_le_encode($module, str, errors=None, /)\n"
1038 "--\n"
1039 "\n");
1040 
1041 #define _CODECS_UTF_16_LE_ENCODE_METHODDEF    \
1042     {"utf_16_le_encode", (PyCFunction)_codecs_utf_16_le_encode, METH_FASTCALL, _codecs_utf_16_le_encode__doc__},
1043 
1044 static PyObject *
1045 _codecs_utf_16_le_encode_impl(PyObject *module, PyObject *str,
1046                               const char *errors);
1047 
1048 static PyObject *
_codecs_utf_16_le_encode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1049 _codecs_utf_16_le_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1050 {
1051     PyObject *return_value = NULL;
1052     PyObject *str;
1053     const char *errors = NULL;
1054 
1055     if (!_PyArg_ParseStack(args, nargs, "U|z:utf_16_le_encode",
1056         &str, &errors)) {
1057         goto exit;
1058     }
1059     return_value = _codecs_utf_16_le_encode_impl(module, str, errors);
1060 
1061 exit:
1062     return return_value;
1063 }
1064 
1065 PyDoc_STRVAR(_codecs_utf_16_be_encode__doc__,
1066 "utf_16_be_encode($module, str, errors=None, /)\n"
1067 "--\n"
1068 "\n");
1069 
1070 #define _CODECS_UTF_16_BE_ENCODE_METHODDEF    \
1071     {"utf_16_be_encode", (PyCFunction)_codecs_utf_16_be_encode, METH_FASTCALL, _codecs_utf_16_be_encode__doc__},
1072 
1073 static PyObject *
1074 _codecs_utf_16_be_encode_impl(PyObject *module, PyObject *str,
1075                               const char *errors);
1076 
1077 static PyObject *
_codecs_utf_16_be_encode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1078 _codecs_utf_16_be_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1079 {
1080     PyObject *return_value = NULL;
1081     PyObject *str;
1082     const char *errors = NULL;
1083 
1084     if (!_PyArg_ParseStack(args, nargs, "U|z:utf_16_be_encode",
1085         &str, &errors)) {
1086         goto exit;
1087     }
1088     return_value = _codecs_utf_16_be_encode_impl(module, str, errors);
1089 
1090 exit:
1091     return return_value;
1092 }
1093 
1094 PyDoc_STRVAR(_codecs_utf_32_encode__doc__,
1095 "utf_32_encode($module, str, errors=None, byteorder=0, /)\n"
1096 "--\n"
1097 "\n");
1098 
1099 #define _CODECS_UTF_32_ENCODE_METHODDEF    \
1100     {"utf_32_encode", (PyCFunction)_codecs_utf_32_encode, METH_FASTCALL, _codecs_utf_32_encode__doc__},
1101 
1102 static PyObject *
1103 _codecs_utf_32_encode_impl(PyObject *module, PyObject *str,
1104                            const char *errors, int byteorder);
1105 
1106 static PyObject *
_codecs_utf_32_encode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1107 _codecs_utf_32_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1108 {
1109     PyObject *return_value = NULL;
1110     PyObject *str;
1111     const char *errors = NULL;
1112     int byteorder = 0;
1113 
1114     if (!_PyArg_ParseStack(args, nargs, "U|zi:utf_32_encode",
1115         &str, &errors, &byteorder)) {
1116         goto exit;
1117     }
1118     return_value = _codecs_utf_32_encode_impl(module, str, errors, byteorder);
1119 
1120 exit:
1121     return return_value;
1122 }
1123 
1124 PyDoc_STRVAR(_codecs_utf_32_le_encode__doc__,
1125 "utf_32_le_encode($module, str, errors=None, /)\n"
1126 "--\n"
1127 "\n");
1128 
1129 #define _CODECS_UTF_32_LE_ENCODE_METHODDEF    \
1130     {"utf_32_le_encode", (PyCFunction)_codecs_utf_32_le_encode, METH_FASTCALL, _codecs_utf_32_le_encode__doc__},
1131 
1132 static PyObject *
1133 _codecs_utf_32_le_encode_impl(PyObject *module, PyObject *str,
1134                               const char *errors);
1135 
1136 static PyObject *
_codecs_utf_32_le_encode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1137 _codecs_utf_32_le_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1138 {
1139     PyObject *return_value = NULL;
1140     PyObject *str;
1141     const char *errors = NULL;
1142 
1143     if (!_PyArg_ParseStack(args, nargs, "U|z:utf_32_le_encode",
1144         &str, &errors)) {
1145         goto exit;
1146     }
1147     return_value = _codecs_utf_32_le_encode_impl(module, str, errors);
1148 
1149 exit:
1150     return return_value;
1151 }
1152 
1153 PyDoc_STRVAR(_codecs_utf_32_be_encode__doc__,
1154 "utf_32_be_encode($module, str, errors=None, /)\n"
1155 "--\n"
1156 "\n");
1157 
1158 #define _CODECS_UTF_32_BE_ENCODE_METHODDEF    \
1159     {"utf_32_be_encode", (PyCFunction)_codecs_utf_32_be_encode, METH_FASTCALL, _codecs_utf_32_be_encode__doc__},
1160 
1161 static PyObject *
1162 _codecs_utf_32_be_encode_impl(PyObject *module, PyObject *str,
1163                               const char *errors);
1164 
1165 static PyObject *
_codecs_utf_32_be_encode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1166 _codecs_utf_32_be_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1167 {
1168     PyObject *return_value = NULL;
1169     PyObject *str;
1170     const char *errors = NULL;
1171 
1172     if (!_PyArg_ParseStack(args, nargs, "U|z:utf_32_be_encode",
1173         &str, &errors)) {
1174         goto exit;
1175     }
1176     return_value = _codecs_utf_32_be_encode_impl(module, str, errors);
1177 
1178 exit:
1179     return return_value;
1180 }
1181 
1182 PyDoc_STRVAR(_codecs_unicode_escape_encode__doc__,
1183 "unicode_escape_encode($module, str, errors=None, /)\n"
1184 "--\n"
1185 "\n");
1186 
1187 #define _CODECS_UNICODE_ESCAPE_ENCODE_METHODDEF    \
1188     {"unicode_escape_encode", (PyCFunction)_codecs_unicode_escape_encode, METH_FASTCALL, _codecs_unicode_escape_encode__doc__},
1189 
1190 static PyObject *
1191 _codecs_unicode_escape_encode_impl(PyObject *module, PyObject *str,
1192                                    const char *errors);
1193 
1194 static PyObject *
_codecs_unicode_escape_encode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1195 _codecs_unicode_escape_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1196 {
1197     PyObject *return_value = NULL;
1198     PyObject *str;
1199     const char *errors = NULL;
1200 
1201     if (!_PyArg_ParseStack(args, nargs, "U|z:unicode_escape_encode",
1202         &str, &errors)) {
1203         goto exit;
1204     }
1205     return_value = _codecs_unicode_escape_encode_impl(module, str, errors);
1206 
1207 exit:
1208     return return_value;
1209 }
1210 
1211 PyDoc_STRVAR(_codecs_raw_unicode_escape_encode__doc__,
1212 "raw_unicode_escape_encode($module, str, errors=None, /)\n"
1213 "--\n"
1214 "\n");
1215 
1216 #define _CODECS_RAW_UNICODE_ESCAPE_ENCODE_METHODDEF    \
1217     {"raw_unicode_escape_encode", (PyCFunction)_codecs_raw_unicode_escape_encode, METH_FASTCALL, _codecs_raw_unicode_escape_encode__doc__},
1218 
1219 static PyObject *
1220 _codecs_raw_unicode_escape_encode_impl(PyObject *module, PyObject *str,
1221                                        const char *errors);
1222 
1223 static PyObject *
_codecs_raw_unicode_escape_encode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1224 _codecs_raw_unicode_escape_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1225 {
1226     PyObject *return_value = NULL;
1227     PyObject *str;
1228     const char *errors = NULL;
1229 
1230     if (!_PyArg_ParseStack(args, nargs, "U|z:raw_unicode_escape_encode",
1231         &str, &errors)) {
1232         goto exit;
1233     }
1234     return_value = _codecs_raw_unicode_escape_encode_impl(module, str, errors);
1235 
1236 exit:
1237     return return_value;
1238 }
1239 
1240 PyDoc_STRVAR(_codecs_latin_1_encode__doc__,
1241 "latin_1_encode($module, str, errors=None, /)\n"
1242 "--\n"
1243 "\n");
1244 
1245 #define _CODECS_LATIN_1_ENCODE_METHODDEF    \
1246     {"latin_1_encode", (PyCFunction)_codecs_latin_1_encode, METH_FASTCALL, _codecs_latin_1_encode__doc__},
1247 
1248 static PyObject *
1249 _codecs_latin_1_encode_impl(PyObject *module, PyObject *str,
1250                             const char *errors);
1251 
1252 static PyObject *
_codecs_latin_1_encode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1253 _codecs_latin_1_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1254 {
1255     PyObject *return_value = NULL;
1256     PyObject *str;
1257     const char *errors = NULL;
1258 
1259     if (!_PyArg_ParseStack(args, nargs, "U|z:latin_1_encode",
1260         &str, &errors)) {
1261         goto exit;
1262     }
1263     return_value = _codecs_latin_1_encode_impl(module, str, errors);
1264 
1265 exit:
1266     return return_value;
1267 }
1268 
1269 PyDoc_STRVAR(_codecs_ascii_encode__doc__,
1270 "ascii_encode($module, str, errors=None, /)\n"
1271 "--\n"
1272 "\n");
1273 
1274 #define _CODECS_ASCII_ENCODE_METHODDEF    \
1275     {"ascii_encode", (PyCFunction)_codecs_ascii_encode, METH_FASTCALL, _codecs_ascii_encode__doc__},
1276 
1277 static PyObject *
1278 _codecs_ascii_encode_impl(PyObject *module, PyObject *str,
1279                           const char *errors);
1280 
1281 static PyObject *
_codecs_ascii_encode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1282 _codecs_ascii_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1283 {
1284     PyObject *return_value = NULL;
1285     PyObject *str;
1286     const char *errors = NULL;
1287 
1288     if (!_PyArg_ParseStack(args, nargs, "U|z:ascii_encode",
1289         &str, &errors)) {
1290         goto exit;
1291     }
1292     return_value = _codecs_ascii_encode_impl(module, str, errors);
1293 
1294 exit:
1295     return return_value;
1296 }
1297 
1298 PyDoc_STRVAR(_codecs_charmap_encode__doc__,
1299 "charmap_encode($module, str, errors=None, mapping=None, /)\n"
1300 "--\n"
1301 "\n");
1302 
1303 #define _CODECS_CHARMAP_ENCODE_METHODDEF    \
1304     {"charmap_encode", (PyCFunction)_codecs_charmap_encode, METH_FASTCALL, _codecs_charmap_encode__doc__},
1305 
1306 static PyObject *
1307 _codecs_charmap_encode_impl(PyObject *module, PyObject *str,
1308                             const char *errors, PyObject *mapping);
1309 
1310 static PyObject *
_codecs_charmap_encode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1311 _codecs_charmap_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1312 {
1313     PyObject *return_value = NULL;
1314     PyObject *str;
1315     const char *errors = NULL;
1316     PyObject *mapping = NULL;
1317 
1318     if (!_PyArg_ParseStack(args, nargs, "U|zO:charmap_encode",
1319         &str, &errors, &mapping)) {
1320         goto exit;
1321     }
1322     return_value = _codecs_charmap_encode_impl(module, str, errors, mapping);
1323 
1324 exit:
1325     return return_value;
1326 }
1327 
1328 PyDoc_STRVAR(_codecs_charmap_build__doc__,
1329 "charmap_build($module, map, /)\n"
1330 "--\n"
1331 "\n");
1332 
1333 #define _CODECS_CHARMAP_BUILD_METHODDEF    \
1334     {"charmap_build", (PyCFunction)_codecs_charmap_build, METH_O, _codecs_charmap_build__doc__},
1335 
1336 static PyObject *
1337 _codecs_charmap_build_impl(PyObject *module, PyObject *map);
1338 
1339 static PyObject *
_codecs_charmap_build(PyObject * module,PyObject * arg)1340 _codecs_charmap_build(PyObject *module, PyObject *arg)
1341 {
1342     PyObject *return_value = NULL;
1343     PyObject *map;
1344 
1345     if (!PyArg_Parse(arg, "U:charmap_build", &map)) {
1346         goto exit;
1347     }
1348     return_value = _codecs_charmap_build_impl(module, map);
1349 
1350 exit:
1351     return return_value;
1352 }
1353 
1354 #if defined(MS_WINDOWS)
1355 
1356 PyDoc_STRVAR(_codecs_mbcs_encode__doc__,
1357 "mbcs_encode($module, str, errors=None, /)\n"
1358 "--\n"
1359 "\n");
1360 
1361 #define _CODECS_MBCS_ENCODE_METHODDEF    \
1362     {"mbcs_encode", (PyCFunction)_codecs_mbcs_encode, METH_FASTCALL, _codecs_mbcs_encode__doc__},
1363 
1364 static PyObject *
1365 _codecs_mbcs_encode_impl(PyObject *module, PyObject *str, const char *errors);
1366 
1367 static PyObject *
_codecs_mbcs_encode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1368 _codecs_mbcs_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1369 {
1370     PyObject *return_value = NULL;
1371     PyObject *str;
1372     const char *errors = NULL;
1373 
1374     if (!_PyArg_ParseStack(args, nargs, "U|z:mbcs_encode",
1375         &str, &errors)) {
1376         goto exit;
1377     }
1378     return_value = _codecs_mbcs_encode_impl(module, str, errors);
1379 
1380 exit:
1381     return return_value;
1382 }
1383 
1384 #endif /* defined(MS_WINDOWS) */
1385 
1386 #if defined(MS_WINDOWS)
1387 
1388 PyDoc_STRVAR(_codecs_oem_encode__doc__,
1389 "oem_encode($module, str, errors=None, /)\n"
1390 "--\n"
1391 "\n");
1392 
1393 #define _CODECS_OEM_ENCODE_METHODDEF    \
1394     {"oem_encode", (PyCFunction)_codecs_oem_encode, METH_FASTCALL, _codecs_oem_encode__doc__},
1395 
1396 static PyObject *
1397 _codecs_oem_encode_impl(PyObject *module, PyObject *str, const char *errors);
1398 
1399 static PyObject *
_codecs_oem_encode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1400 _codecs_oem_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1401 {
1402     PyObject *return_value = NULL;
1403     PyObject *str;
1404     const char *errors = NULL;
1405 
1406     if (!_PyArg_ParseStack(args, nargs, "U|z:oem_encode",
1407         &str, &errors)) {
1408         goto exit;
1409     }
1410     return_value = _codecs_oem_encode_impl(module, str, errors);
1411 
1412 exit:
1413     return return_value;
1414 }
1415 
1416 #endif /* defined(MS_WINDOWS) */
1417 
1418 #if defined(MS_WINDOWS)
1419 
1420 PyDoc_STRVAR(_codecs_code_page_encode__doc__,
1421 "code_page_encode($module, code_page, str, errors=None, /)\n"
1422 "--\n"
1423 "\n");
1424 
1425 #define _CODECS_CODE_PAGE_ENCODE_METHODDEF    \
1426     {"code_page_encode", (PyCFunction)_codecs_code_page_encode, METH_FASTCALL, _codecs_code_page_encode__doc__},
1427 
1428 static PyObject *
1429 _codecs_code_page_encode_impl(PyObject *module, int code_page, PyObject *str,
1430                               const char *errors);
1431 
1432 static PyObject *
_codecs_code_page_encode(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1433 _codecs_code_page_encode(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1434 {
1435     PyObject *return_value = NULL;
1436     int code_page;
1437     PyObject *str;
1438     const char *errors = NULL;
1439 
1440     if (!_PyArg_ParseStack(args, nargs, "iU|z:code_page_encode",
1441         &code_page, &str, &errors)) {
1442         goto exit;
1443     }
1444     return_value = _codecs_code_page_encode_impl(module, code_page, str, errors);
1445 
1446 exit:
1447     return return_value;
1448 }
1449 
1450 #endif /* defined(MS_WINDOWS) */
1451 
1452 PyDoc_STRVAR(_codecs_register_error__doc__,
1453 "register_error($module, errors, handler, /)\n"
1454 "--\n"
1455 "\n"
1456 "Register the specified error handler under the name errors.\n"
1457 "\n"
1458 "handler must be a callable object, that will be called with an exception\n"
1459 "instance containing information about the location of the encoding/decoding\n"
1460 "error and must return a (replacement, new position) tuple.");
1461 
1462 #define _CODECS_REGISTER_ERROR_METHODDEF    \
1463     {"register_error", (PyCFunction)_codecs_register_error, METH_FASTCALL, _codecs_register_error__doc__},
1464 
1465 static PyObject *
1466 _codecs_register_error_impl(PyObject *module, const char *errors,
1467                             PyObject *handler);
1468 
1469 static PyObject *
_codecs_register_error(PyObject * module,PyObject * const * args,Py_ssize_t nargs)1470 _codecs_register_error(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
1471 {
1472     PyObject *return_value = NULL;
1473     const char *errors;
1474     PyObject *handler;
1475 
1476     if (!_PyArg_ParseStack(args, nargs, "sO:register_error",
1477         &errors, &handler)) {
1478         goto exit;
1479     }
1480     return_value = _codecs_register_error_impl(module, errors, handler);
1481 
1482 exit:
1483     return return_value;
1484 }
1485 
1486 PyDoc_STRVAR(_codecs_lookup_error__doc__,
1487 "lookup_error($module, name, /)\n"
1488 "--\n"
1489 "\n"
1490 "lookup_error(errors) -> handler\n"
1491 "\n"
1492 "Return the error handler for the specified error handling name or raise a\n"
1493 "LookupError, if no handler exists under this name.");
1494 
1495 #define _CODECS_LOOKUP_ERROR_METHODDEF    \
1496     {"lookup_error", (PyCFunction)_codecs_lookup_error, METH_O, _codecs_lookup_error__doc__},
1497 
1498 static PyObject *
1499 _codecs_lookup_error_impl(PyObject *module, const char *name);
1500 
1501 static PyObject *
_codecs_lookup_error(PyObject * module,PyObject * arg)1502 _codecs_lookup_error(PyObject *module, PyObject *arg)
1503 {
1504     PyObject *return_value = NULL;
1505     const char *name;
1506 
1507     if (!PyArg_Parse(arg, "s:lookup_error", &name)) {
1508         goto exit;
1509     }
1510     return_value = _codecs_lookup_error_impl(module, name);
1511 
1512 exit:
1513     return return_value;
1514 }
1515 
1516 #ifndef _CODECS_MBCS_DECODE_METHODDEF
1517     #define _CODECS_MBCS_DECODE_METHODDEF
1518 #endif /* !defined(_CODECS_MBCS_DECODE_METHODDEF) */
1519 
1520 #ifndef _CODECS_OEM_DECODE_METHODDEF
1521     #define _CODECS_OEM_DECODE_METHODDEF
1522 #endif /* !defined(_CODECS_OEM_DECODE_METHODDEF) */
1523 
1524 #ifndef _CODECS_CODE_PAGE_DECODE_METHODDEF
1525     #define _CODECS_CODE_PAGE_DECODE_METHODDEF
1526 #endif /* !defined(_CODECS_CODE_PAGE_DECODE_METHODDEF) */
1527 
1528 #ifndef _CODECS_MBCS_ENCODE_METHODDEF
1529     #define _CODECS_MBCS_ENCODE_METHODDEF
1530 #endif /* !defined(_CODECS_MBCS_ENCODE_METHODDEF) */
1531 
1532 #ifndef _CODECS_OEM_ENCODE_METHODDEF
1533     #define _CODECS_OEM_ENCODE_METHODDEF
1534 #endif /* !defined(_CODECS_OEM_ENCODE_METHODDEF) */
1535 
1536 #ifndef _CODECS_CODE_PAGE_ENCODE_METHODDEF
1537     #define _CODECS_CODE_PAGE_ENCODE_METHODDEF
1538 #endif /* !defined(_CODECS_CODE_PAGE_ENCODE_METHODDEF) */
1539 /*[clinic end generated code: output=06fa0d6803103c62 input=a9049054013a1b77]*/
1540