Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5)

Side by Side Diff: Modules/clinic/_codecsmodule.c.h

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

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+