1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4
5 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
6 # include "pycore_gc.h" // PyGC_Head
7 # include "pycore_runtime.h" // _Py_ID()
8 #endif
9 #include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
10
11 PyDoc_STRVAR(_multibytecodec_MultibyteCodec_encode__doc__,
12 "encode($self, /, input, errors=None)\n"
13 "--\n"
14 "\n"
15 "Return an encoded string version of `input\'.\n"
16 "\n"
17 "\'errors\' may be given to set a different error handling scheme. Default is\n"
18 "\'strict\' meaning that encoding errors raise a UnicodeEncodeError. Other possible\n"
19 "values are \'ignore\', \'replace\' and \'xmlcharrefreplace\' as well as any other name\n"
20 "registered with codecs.register_error that can handle UnicodeEncodeErrors.");
21
22 #define _MULTIBYTECODEC_MULTIBYTECODEC_ENCODE_METHODDEF \
23 {"encode", _PyCFunction_CAST(_multibytecodec_MultibyteCodec_encode), METH_FASTCALL|METH_KEYWORDS, _multibytecodec_MultibyteCodec_encode__doc__},
24
25 static PyObject *
26 _multibytecodec_MultibyteCodec_encode_impl(MultibyteCodecObject *self,
27 PyObject *input,
28 const char *errors);
29
30 static PyObject *
_multibytecodec_MultibyteCodec_encode(MultibyteCodecObject * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)31 _multibytecodec_MultibyteCodec_encode(MultibyteCodecObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
32 {
33 PyObject *return_value = NULL;
34 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
35
36 #define NUM_KEYWORDS 2
37 static struct {
38 PyGC_Head _this_is_not_used;
39 PyObject_VAR_HEAD
40 PyObject *ob_item[NUM_KEYWORDS];
41 } _kwtuple = {
42 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
43 .ob_item = { &_Py_ID(input), &_Py_ID(errors), },
44 };
45 #undef NUM_KEYWORDS
46 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
47
48 #else // !Py_BUILD_CORE
49 # define KWTUPLE NULL
50 #endif // !Py_BUILD_CORE
51
52 static const char * const _keywords[] = {"input", "errors", NULL};
53 static _PyArg_Parser _parser = {
54 .keywords = _keywords,
55 .fname = "encode",
56 .kwtuple = KWTUPLE,
57 };
58 #undef KWTUPLE
59 PyObject *argsbuf[2];
60 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
61 PyObject *input;
62 const char *errors = NULL;
63
64 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
65 if (!args) {
66 goto exit;
67 }
68 input = args[0];
69 if (!noptargs) {
70 goto skip_optional_pos;
71 }
72 if (args[1] == Py_None) {
73 errors = NULL;
74 }
75 else if (PyUnicode_Check(args[1])) {
76 Py_ssize_t errors_length;
77 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
78 if (errors == NULL) {
79 goto exit;
80 }
81 if (strlen(errors) != (size_t)errors_length) {
82 PyErr_SetString(PyExc_ValueError, "embedded null character");
83 goto exit;
84 }
85 }
86 else {
87 _PyArg_BadArgument("encode", "argument 'errors'", "str or None", args[1]);
88 goto exit;
89 }
90 skip_optional_pos:
91 return_value = _multibytecodec_MultibyteCodec_encode_impl(self, input, errors);
92
93 exit:
94 return return_value;
95 }
96
97 PyDoc_STRVAR(_multibytecodec_MultibyteCodec_decode__doc__,
98 "decode($self, /, input, errors=None)\n"
99 "--\n"
100 "\n"
101 "Decodes \'input\'.\n"
102 "\n"
103 "\'errors\' may be given to set a different error handling scheme. Default is\n"
104 "\'strict\' meaning that encoding errors raise a UnicodeDecodeError. Other possible\n"
105 "values are \'ignore\' and \'replace\' as well as any other name registered with\n"
106 "codecs.register_error that is able to handle UnicodeDecodeErrors.\"");
107
108 #define _MULTIBYTECODEC_MULTIBYTECODEC_DECODE_METHODDEF \
109 {"decode", _PyCFunction_CAST(_multibytecodec_MultibyteCodec_decode), METH_FASTCALL|METH_KEYWORDS, _multibytecodec_MultibyteCodec_decode__doc__},
110
111 static PyObject *
112 _multibytecodec_MultibyteCodec_decode_impl(MultibyteCodecObject *self,
113 Py_buffer *input,
114 const char *errors);
115
116 static PyObject *
_multibytecodec_MultibyteCodec_decode(MultibyteCodecObject * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)117 _multibytecodec_MultibyteCodec_decode(MultibyteCodecObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
118 {
119 PyObject *return_value = NULL;
120 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
121
122 #define NUM_KEYWORDS 2
123 static struct {
124 PyGC_Head _this_is_not_used;
125 PyObject_VAR_HEAD
126 PyObject *ob_item[NUM_KEYWORDS];
127 } _kwtuple = {
128 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
129 .ob_item = { &_Py_ID(input), &_Py_ID(errors), },
130 };
131 #undef NUM_KEYWORDS
132 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
133
134 #else // !Py_BUILD_CORE
135 # define KWTUPLE NULL
136 #endif // !Py_BUILD_CORE
137
138 static const char * const _keywords[] = {"input", "errors", NULL};
139 static _PyArg_Parser _parser = {
140 .keywords = _keywords,
141 .fname = "decode",
142 .kwtuple = KWTUPLE,
143 };
144 #undef KWTUPLE
145 PyObject *argsbuf[2];
146 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
147 Py_buffer input = {NULL, NULL};
148 const char *errors = NULL;
149
150 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
151 if (!args) {
152 goto exit;
153 }
154 if (PyObject_GetBuffer(args[0], &input, PyBUF_SIMPLE) != 0) {
155 goto exit;
156 }
157 if (!noptargs) {
158 goto skip_optional_pos;
159 }
160 if (args[1] == Py_None) {
161 errors = NULL;
162 }
163 else if (PyUnicode_Check(args[1])) {
164 Py_ssize_t errors_length;
165 errors = PyUnicode_AsUTF8AndSize(args[1], &errors_length);
166 if (errors == NULL) {
167 goto exit;
168 }
169 if (strlen(errors) != (size_t)errors_length) {
170 PyErr_SetString(PyExc_ValueError, "embedded null character");
171 goto exit;
172 }
173 }
174 else {
175 _PyArg_BadArgument("decode", "argument 'errors'", "str or None", args[1]);
176 goto exit;
177 }
178 skip_optional_pos:
179 return_value = _multibytecodec_MultibyteCodec_decode_impl(self, &input, errors);
180
181 exit:
182 /* Cleanup for input */
183 if (input.obj) {
184 PyBuffer_Release(&input);
185 }
186
187 return return_value;
188 }
189
190 PyDoc_STRVAR(_multibytecodec_MultibyteIncrementalEncoder_encode__doc__,
191 "encode($self, /, input, final=False)\n"
192 "--\n"
193 "\n");
194
195 #define _MULTIBYTECODEC_MULTIBYTEINCREMENTALENCODER_ENCODE_METHODDEF \
196 {"encode", _PyCFunction_CAST(_multibytecodec_MultibyteIncrementalEncoder_encode), METH_FASTCALL|METH_KEYWORDS, _multibytecodec_MultibyteIncrementalEncoder_encode__doc__},
197
198 static PyObject *
199 _multibytecodec_MultibyteIncrementalEncoder_encode_impl(MultibyteIncrementalEncoderObject *self,
200 PyObject *input,
201 int final);
202
203 static PyObject *
_multibytecodec_MultibyteIncrementalEncoder_encode(MultibyteIncrementalEncoderObject * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)204 _multibytecodec_MultibyteIncrementalEncoder_encode(MultibyteIncrementalEncoderObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
205 {
206 PyObject *return_value = NULL;
207 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
208
209 #define NUM_KEYWORDS 2
210 static struct {
211 PyGC_Head _this_is_not_used;
212 PyObject_VAR_HEAD
213 PyObject *ob_item[NUM_KEYWORDS];
214 } _kwtuple = {
215 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
216 .ob_item = { &_Py_ID(input), &_Py_ID(final), },
217 };
218 #undef NUM_KEYWORDS
219 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
220
221 #else // !Py_BUILD_CORE
222 # define KWTUPLE NULL
223 #endif // !Py_BUILD_CORE
224
225 static const char * const _keywords[] = {"input", "final", NULL};
226 static _PyArg_Parser _parser = {
227 .keywords = _keywords,
228 .fname = "encode",
229 .kwtuple = KWTUPLE,
230 };
231 #undef KWTUPLE
232 PyObject *argsbuf[2];
233 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
234 PyObject *input;
235 int final = 0;
236
237 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
238 if (!args) {
239 goto exit;
240 }
241 input = args[0];
242 if (!noptargs) {
243 goto skip_optional_pos;
244 }
245 final = PyObject_IsTrue(args[1]);
246 if (final < 0) {
247 goto exit;
248 }
249 skip_optional_pos:
250 return_value = _multibytecodec_MultibyteIncrementalEncoder_encode_impl(self, input, final);
251
252 exit:
253 return return_value;
254 }
255
256 PyDoc_STRVAR(_multibytecodec_MultibyteIncrementalEncoder_getstate__doc__,
257 "getstate($self, /)\n"
258 "--\n"
259 "\n");
260
261 #define _MULTIBYTECODEC_MULTIBYTEINCREMENTALENCODER_GETSTATE_METHODDEF \
262 {"getstate", (PyCFunction)_multibytecodec_MultibyteIncrementalEncoder_getstate, METH_NOARGS, _multibytecodec_MultibyteIncrementalEncoder_getstate__doc__},
263
264 static PyObject *
265 _multibytecodec_MultibyteIncrementalEncoder_getstate_impl(MultibyteIncrementalEncoderObject *self);
266
267 static PyObject *
_multibytecodec_MultibyteIncrementalEncoder_getstate(MultibyteIncrementalEncoderObject * self,PyObject * Py_UNUSED (ignored))268 _multibytecodec_MultibyteIncrementalEncoder_getstate(MultibyteIncrementalEncoderObject *self, PyObject *Py_UNUSED(ignored))
269 {
270 return _multibytecodec_MultibyteIncrementalEncoder_getstate_impl(self);
271 }
272
273 PyDoc_STRVAR(_multibytecodec_MultibyteIncrementalEncoder_setstate__doc__,
274 "setstate($self, state, /)\n"
275 "--\n"
276 "\n");
277
278 #define _MULTIBYTECODEC_MULTIBYTEINCREMENTALENCODER_SETSTATE_METHODDEF \
279 {"setstate", (PyCFunction)_multibytecodec_MultibyteIncrementalEncoder_setstate, METH_O, _multibytecodec_MultibyteIncrementalEncoder_setstate__doc__},
280
281 static PyObject *
282 _multibytecodec_MultibyteIncrementalEncoder_setstate_impl(MultibyteIncrementalEncoderObject *self,
283 PyLongObject *statelong);
284
285 static PyObject *
_multibytecodec_MultibyteIncrementalEncoder_setstate(MultibyteIncrementalEncoderObject * self,PyObject * arg)286 _multibytecodec_MultibyteIncrementalEncoder_setstate(MultibyteIncrementalEncoderObject *self, PyObject *arg)
287 {
288 PyObject *return_value = NULL;
289 PyLongObject *statelong;
290
291 if (!PyLong_Check(arg)) {
292 _PyArg_BadArgument("setstate", "argument", "int", arg);
293 goto exit;
294 }
295 statelong = (PyLongObject *)arg;
296 return_value = _multibytecodec_MultibyteIncrementalEncoder_setstate_impl(self, statelong);
297
298 exit:
299 return return_value;
300 }
301
302 PyDoc_STRVAR(_multibytecodec_MultibyteIncrementalEncoder_reset__doc__,
303 "reset($self, /)\n"
304 "--\n"
305 "\n");
306
307 #define _MULTIBYTECODEC_MULTIBYTEINCREMENTALENCODER_RESET_METHODDEF \
308 {"reset", (PyCFunction)_multibytecodec_MultibyteIncrementalEncoder_reset, METH_NOARGS, _multibytecodec_MultibyteIncrementalEncoder_reset__doc__},
309
310 static PyObject *
311 _multibytecodec_MultibyteIncrementalEncoder_reset_impl(MultibyteIncrementalEncoderObject *self);
312
313 static PyObject *
_multibytecodec_MultibyteIncrementalEncoder_reset(MultibyteIncrementalEncoderObject * self,PyObject * Py_UNUSED (ignored))314 _multibytecodec_MultibyteIncrementalEncoder_reset(MultibyteIncrementalEncoderObject *self, PyObject *Py_UNUSED(ignored))
315 {
316 return _multibytecodec_MultibyteIncrementalEncoder_reset_impl(self);
317 }
318
319 PyDoc_STRVAR(_multibytecodec_MultibyteIncrementalDecoder_decode__doc__,
320 "decode($self, /, input, final=False)\n"
321 "--\n"
322 "\n");
323
324 #define _MULTIBYTECODEC_MULTIBYTEINCREMENTALDECODER_DECODE_METHODDEF \
325 {"decode", _PyCFunction_CAST(_multibytecodec_MultibyteIncrementalDecoder_decode), METH_FASTCALL|METH_KEYWORDS, _multibytecodec_MultibyteIncrementalDecoder_decode__doc__},
326
327 static PyObject *
328 _multibytecodec_MultibyteIncrementalDecoder_decode_impl(MultibyteIncrementalDecoderObject *self,
329 Py_buffer *input,
330 int final);
331
332 static PyObject *
_multibytecodec_MultibyteIncrementalDecoder_decode(MultibyteIncrementalDecoderObject * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)333 _multibytecodec_MultibyteIncrementalDecoder_decode(MultibyteIncrementalDecoderObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
334 {
335 PyObject *return_value = NULL;
336 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
337
338 #define NUM_KEYWORDS 2
339 static struct {
340 PyGC_Head _this_is_not_used;
341 PyObject_VAR_HEAD
342 PyObject *ob_item[NUM_KEYWORDS];
343 } _kwtuple = {
344 .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
345 .ob_item = { &_Py_ID(input), &_Py_ID(final), },
346 };
347 #undef NUM_KEYWORDS
348 #define KWTUPLE (&_kwtuple.ob_base.ob_base)
349
350 #else // !Py_BUILD_CORE
351 # define KWTUPLE NULL
352 #endif // !Py_BUILD_CORE
353
354 static const char * const _keywords[] = {"input", "final", NULL};
355 static _PyArg_Parser _parser = {
356 .keywords = _keywords,
357 .fname = "decode",
358 .kwtuple = KWTUPLE,
359 };
360 #undef KWTUPLE
361 PyObject *argsbuf[2];
362 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
363 Py_buffer input = {NULL, NULL};
364 int final = 0;
365
366 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
367 if (!args) {
368 goto exit;
369 }
370 if (PyObject_GetBuffer(args[0], &input, PyBUF_SIMPLE) != 0) {
371 goto exit;
372 }
373 if (!noptargs) {
374 goto skip_optional_pos;
375 }
376 final = PyObject_IsTrue(args[1]);
377 if (final < 0) {
378 goto exit;
379 }
380 skip_optional_pos:
381 return_value = _multibytecodec_MultibyteIncrementalDecoder_decode_impl(self, &input, final);
382
383 exit:
384 /* Cleanup for input */
385 if (input.obj) {
386 PyBuffer_Release(&input);
387 }
388
389 return return_value;
390 }
391
392 PyDoc_STRVAR(_multibytecodec_MultibyteIncrementalDecoder_getstate__doc__,
393 "getstate($self, /)\n"
394 "--\n"
395 "\n");
396
397 #define _MULTIBYTECODEC_MULTIBYTEINCREMENTALDECODER_GETSTATE_METHODDEF \
398 {"getstate", (PyCFunction)_multibytecodec_MultibyteIncrementalDecoder_getstate, METH_NOARGS, _multibytecodec_MultibyteIncrementalDecoder_getstate__doc__},
399
400 static PyObject *
401 _multibytecodec_MultibyteIncrementalDecoder_getstate_impl(MultibyteIncrementalDecoderObject *self);
402
403 static PyObject *
_multibytecodec_MultibyteIncrementalDecoder_getstate(MultibyteIncrementalDecoderObject * self,PyObject * Py_UNUSED (ignored))404 _multibytecodec_MultibyteIncrementalDecoder_getstate(MultibyteIncrementalDecoderObject *self, PyObject *Py_UNUSED(ignored))
405 {
406 return _multibytecodec_MultibyteIncrementalDecoder_getstate_impl(self);
407 }
408
409 PyDoc_STRVAR(_multibytecodec_MultibyteIncrementalDecoder_setstate__doc__,
410 "setstate($self, state, /)\n"
411 "--\n"
412 "\n");
413
414 #define _MULTIBYTECODEC_MULTIBYTEINCREMENTALDECODER_SETSTATE_METHODDEF \
415 {"setstate", (PyCFunction)_multibytecodec_MultibyteIncrementalDecoder_setstate, METH_O, _multibytecodec_MultibyteIncrementalDecoder_setstate__doc__},
416
417 static PyObject *
418 _multibytecodec_MultibyteIncrementalDecoder_setstate_impl(MultibyteIncrementalDecoderObject *self,
419 PyObject *state);
420
421 static PyObject *
_multibytecodec_MultibyteIncrementalDecoder_setstate(MultibyteIncrementalDecoderObject * self,PyObject * arg)422 _multibytecodec_MultibyteIncrementalDecoder_setstate(MultibyteIncrementalDecoderObject *self, PyObject *arg)
423 {
424 PyObject *return_value = NULL;
425 PyObject *state;
426
427 if (!PyTuple_Check(arg)) {
428 _PyArg_BadArgument("setstate", "argument", "tuple", arg);
429 goto exit;
430 }
431 state = arg;
432 return_value = _multibytecodec_MultibyteIncrementalDecoder_setstate_impl(self, state);
433
434 exit:
435 return return_value;
436 }
437
438 PyDoc_STRVAR(_multibytecodec_MultibyteIncrementalDecoder_reset__doc__,
439 "reset($self, /)\n"
440 "--\n"
441 "\n");
442
443 #define _MULTIBYTECODEC_MULTIBYTEINCREMENTALDECODER_RESET_METHODDEF \
444 {"reset", (PyCFunction)_multibytecodec_MultibyteIncrementalDecoder_reset, METH_NOARGS, _multibytecodec_MultibyteIncrementalDecoder_reset__doc__},
445
446 static PyObject *
447 _multibytecodec_MultibyteIncrementalDecoder_reset_impl(MultibyteIncrementalDecoderObject *self);
448
449 static PyObject *
_multibytecodec_MultibyteIncrementalDecoder_reset(MultibyteIncrementalDecoderObject * self,PyObject * Py_UNUSED (ignored))450 _multibytecodec_MultibyteIncrementalDecoder_reset(MultibyteIncrementalDecoderObject *self, PyObject *Py_UNUSED(ignored))
451 {
452 return _multibytecodec_MultibyteIncrementalDecoder_reset_impl(self);
453 }
454
455 PyDoc_STRVAR(_multibytecodec_MultibyteStreamReader_read__doc__,
456 "read($self, sizeobj=None, /)\n"
457 "--\n"
458 "\n");
459
460 #define _MULTIBYTECODEC_MULTIBYTESTREAMREADER_READ_METHODDEF \
461 {"read", _PyCFunction_CAST(_multibytecodec_MultibyteStreamReader_read), METH_FASTCALL, _multibytecodec_MultibyteStreamReader_read__doc__},
462
463 static PyObject *
464 _multibytecodec_MultibyteStreamReader_read_impl(MultibyteStreamReaderObject *self,
465 PyObject *sizeobj);
466
467 static PyObject *
_multibytecodec_MultibyteStreamReader_read(MultibyteStreamReaderObject * self,PyObject * const * args,Py_ssize_t nargs)468 _multibytecodec_MultibyteStreamReader_read(MultibyteStreamReaderObject *self, PyObject *const *args, Py_ssize_t nargs)
469 {
470 PyObject *return_value = NULL;
471 PyObject *sizeobj = Py_None;
472
473 if (!_PyArg_CheckPositional("read", nargs, 0, 1)) {
474 goto exit;
475 }
476 if (nargs < 1) {
477 goto skip_optional;
478 }
479 sizeobj = args[0];
480 skip_optional:
481 return_value = _multibytecodec_MultibyteStreamReader_read_impl(self, sizeobj);
482
483 exit:
484 return return_value;
485 }
486
487 PyDoc_STRVAR(_multibytecodec_MultibyteStreamReader_readline__doc__,
488 "readline($self, sizeobj=None, /)\n"
489 "--\n"
490 "\n");
491
492 #define _MULTIBYTECODEC_MULTIBYTESTREAMREADER_READLINE_METHODDEF \
493 {"readline", _PyCFunction_CAST(_multibytecodec_MultibyteStreamReader_readline), METH_FASTCALL, _multibytecodec_MultibyteStreamReader_readline__doc__},
494
495 static PyObject *
496 _multibytecodec_MultibyteStreamReader_readline_impl(MultibyteStreamReaderObject *self,
497 PyObject *sizeobj);
498
499 static PyObject *
_multibytecodec_MultibyteStreamReader_readline(MultibyteStreamReaderObject * self,PyObject * const * args,Py_ssize_t nargs)500 _multibytecodec_MultibyteStreamReader_readline(MultibyteStreamReaderObject *self, PyObject *const *args, Py_ssize_t nargs)
501 {
502 PyObject *return_value = NULL;
503 PyObject *sizeobj = Py_None;
504
505 if (!_PyArg_CheckPositional("readline", nargs, 0, 1)) {
506 goto exit;
507 }
508 if (nargs < 1) {
509 goto skip_optional;
510 }
511 sizeobj = args[0];
512 skip_optional:
513 return_value = _multibytecodec_MultibyteStreamReader_readline_impl(self, sizeobj);
514
515 exit:
516 return return_value;
517 }
518
519 PyDoc_STRVAR(_multibytecodec_MultibyteStreamReader_readlines__doc__,
520 "readlines($self, sizehintobj=None, /)\n"
521 "--\n"
522 "\n");
523
524 #define _MULTIBYTECODEC_MULTIBYTESTREAMREADER_READLINES_METHODDEF \
525 {"readlines", _PyCFunction_CAST(_multibytecodec_MultibyteStreamReader_readlines), METH_FASTCALL, _multibytecodec_MultibyteStreamReader_readlines__doc__},
526
527 static PyObject *
528 _multibytecodec_MultibyteStreamReader_readlines_impl(MultibyteStreamReaderObject *self,
529 PyObject *sizehintobj);
530
531 static PyObject *
_multibytecodec_MultibyteStreamReader_readlines(MultibyteStreamReaderObject * self,PyObject * const * args,Py_ssize_t nargs)532 _multibytecodec_MultibyteStreamReader_readlines(MultibyteStreamReaderObject *self, PyObject *const *args, Py_ssize_t nargs)
533 {
534 PyObject *return_value = NULL;
535 PyObject *sizehintobj = Py_None;
536
537 if (!_PyArg_CheckPositional("readlines", nargs, 0, 1)) {
538 goto exit;
539 }
540 if (nargs < 1) {
541 goto skip_optional;
542 }
543 sizehintobj = args[0];
544 skip_optional:
545 return_value = _multibytecodec_MultibyteStreamReader_readlines_impl(self, sizehintobj);
546
547 exit:
548 return return_value;
549 }
550
551 PyDoc_STRVAR(_multibytecodec_MultibyteStreamReader_reset__doc__,
552 "reset($self, /)\n"
553 "--\n"
554 "\n");
555
556 #define _MULTIBYTECODEC_MULTIBYTESTREAMREADER_RESET_METHODDEF \
557 {"reset", (PyCFunction)_multibytecodec_MultibyteStreamReader_reset, METH_NOARGS, _multibytecodec_MultibyteStreamReader_reset__doc__},
558
559 static PyObject *
560 _multibytecodec_MultibyteStreamReader_reset_impl(MultibyteStreamReaderObject *self);
561
562 static PyObject *
_multibytecodec_MultibyteStreamReader_reset(MultibyteStreamReaderObject * self,PyObject * Py_UNUSED (ignored))563 _multibytecodec_MultibyteStreamReader_reset(MultibyteStreamReaderObject *self, PyObject *Py_UNUSED(ignored))
564 {
565 return _multibytecodec_MultibyteStreamReader_reset_impl(self);
566 }
567
568 PyDoc_STRVAR(_multibytecodec_MultibyteStreamWriter_write__doc__,
569 "write($self, strobj, /)\n"
570 "--\n"
571 "\n");
572
573 #define _MULTIBYTECODEC_MULTIBYTESTREAMWRITER_WRITE_METHODDEF \
574 {"write", _PyCFunction_CAST(_multibytecodec_MultibyteStreamWriter_write), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _multibytecodec_MultibyteStreamWriter_write__doc__},
575
576 static PyObject *
577 _multibytecodec_MultibyteStreamWriter_write_impl(MultibyteStreamWriterObject *self,
578 PyTypeObject *cls,
579 PyObject *strobj);
580
581 static PyObject *
_multibytecodec_MultibyteStreamWriter_write(MultibyteStreamWriterObject * self,PyTypeObject * cls,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)582 _multibytecodec_MultibyteStreamWriter_write(MultibyteStreamWriterObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
583 {
584 PyObject *return_value = NULL;
585 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
586 # define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
587 #else
588 # define KWTUPLE NULL
589 #endif
590
591 static const char * const _keywords[] = {"", NULL};
592 static _PyArg_Parser _parser = {
593 .keywords = _keywords,
594 .fname = "write",
595 .kwtuple = KWTUPLE,
596 };
597 #undef KWTUPLE
598 PyObject *argsbuf[1];
599 PyObject *strobj;
600
601 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
602 if (!args) {
603 goto exit;
604 }
605 strobj = args[0];
606 return_value = _multibytecodec_MultibyteStreamWriter_write_impl(self, cls, strobj);
607
608 exit:
609 return return_value;
610 }
611
612 PyDoc_STRVAR(_multibytecodec_MultibyteStreamWriter_writelines__doc__,
613 "writelines($self, lines, /)\n"
614 "--\n"
615 "\n");
616
617 #define _MULTIBYTECODEC_MULTIBYTESTREAMWRITER_WRITELINES_METHODDEF \
618 {"writelines", _PyCFunction_CAST(_multibytecodec_MultibyteStreamWriter_writelines), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _multibytecodec_MultibyteStreamWriter_writelines__doc__},
619
620 static PyObject *
621 _multibytecodec_MultibyteStreamWriter_writelines_impl(MultibyteStreamWriterObject *self,
622 PyTypeObject *cls,
623 PyObject *lines);
624
625 static PyObject *
_multibytecodec_MultibyteStreamWriter_writelines(MultibyteStreamWriterObject * self,PyTypeObject * cls,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)626 _multibytecodec_MultibyteStreamWriter_writelines(MultibyteStreamWriterObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
627 {
628 PyObject *return_value = NULL;
629 #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
630 # define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
631 #else
632 # define KWTUPLE NULL
633 #endif
634
635 static const char * const _keywords[] = {"", NULL};
636 static _PyArg_Parser _parser = {
637 .keywords = _keywords,
638 .fname = "writelines",
639 .kwtuple = KWTUPLE,
640 };
641 #undef KWTUPLE
642 PyObject *argsbuf[1];
643 PyObject *lines;
644
645 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
646 if (!args) {
647 goto exit;
648 }
649 lines = args[0];
650 return_value = _multibytecodec_MultibyteStreamWriter_writelines_impl(self, cls, lines);
651
652 exit:
653 return return_value;
654 }
655
656 PyDoc_STRVAR(_multibytecodec_MultibyteStreamWriter_reset__doc__,
657 "reset($self, /)\n"
658 "--\n"
659 "\n");
660
661 #define _MULTIBYTECODEC_MULTIBYTESTREAMWRITER_RESET_METHODDEF \
662 {"reset", _PyCFunction_CAST(_multibytecodec_MultibyteStreamWriter_reset), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _multibytecodec_MultibyteStreamWriter_reset__doc__},
663
664 static PyObject *
665 _multibytecodec_MultibyteStreamWriter_reset_impl(MultibyteStreamWriterObject *self,
666 PyTypeObject *cls);
667
668 static PyObject *
_multibytecodec_MultibyteStreamWriter_reset(MultibyteStreamWriterObject * self,PyTypeObject * cls,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)669 _multibytecodec_MultibyteStreamWriter_reset(MultibyteStreamWriterObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
670 {
671 if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
672 PyErr_SetString(PyExc_TypeError, "reset() takes no arguments");
673 return NULL;
674 }
675 return _multibytecodec_MultibyteStreamWriter_reset_impl(self, cls);
676 }
677
678 PyDoc_STRVAR(_multibytecodec___create_codec__doc__,
679 "__create_codec($module, arg, /)\n"
680 "--\n"
681 "\n");
682
683 #define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF \
684 {"__create_codec", (PyCFunction)_multibytecodec___create_codec, METH_O, _multibytecodec___create_codec__doc__},
685 /*[clinic end generated code: output=ee767a6d93c7108a input=a9049054013a1b77]*/
686