Skip to content

Commit f2de1fc

Browse files
committed
Issue python#20152: Convert _multibytecodecs to Argument Clinic.
1 parent adc5634 commit f2de1fc

File tree

2 files changed

+492
-142
lines changed

2 files changed

+492
-142
lines changed
Lines changed: 301 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,301 @@
1+
/*[clinic input]
2+
preserve
3+
[clinic start generated code]*/
4+
5+
PyDoc_STRVAR(_multibytecodec_MultibyteCodec_encode__doc__,
6+
"encode($self, /, input, errors=None)\n"
7+
"--\n"
8+
"\n"
9+
"Return an encoded string version of `input\'.\n"
10+
"\n"
11+
"\'errors\' may be given to set a different error handling scheme. Default is\n"
12+
"\'strict\' meaning that encoding errors raise a UnicodeEncodeError. Other possible\n"
13+
"values are \'ignore\', \'replace\' and \'xmlcharrefreplace\' as well as any other name\n"
14+
"registered with codecs.register_error that can handle UnicodeEncodeErrors.");
15+
16+
#define _MULTIBYTECODEC_MULTIBYTECODEC_ENCODE_METHODDEF \
17+
{"encode", (PyCFunction)_multibytecodec_MultibyteCodec_encode, METH_VARARGS|METH_KEYWORDS, _multibytecodec_MultibyteCodec_encode__doc__},
18+
19+
static PyObject *
20+
_multibytecodec_MultibyteCodec_encode_impl(MultibyteCodecObject *self, PyObject *input, const char *errors);
21+
22+
static PyObject *
23+
_multibytecodec_MultibyteCodec_encode(MultibyteCodecObject *self, PyObject *args, PyObject *kwargs)
24+
{
25+
PyObject *return_value = NULL;
26+
static char *_keywords[] = {"input", "errors", NULL};
27+
PyObject *input;
28+
const char *errors = NULL;
29+
30+
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
31+
"O|z:encode", _keywords,
32+
&input, &errors))
33+
goto exit;
34+
return_value = _multibytecodec_MultibyteCodec_encode_impl(self, input, errors);
35+
36+
exit:
37+
return return_value;
38+
}
39+
40+
PyDoc_STRVAR(_multibytecodec_MultibyteCodec_decode__doc__,
41+
"decode($self, /, input, errors=None)\n"
42+
"--\n"
43+
"\n"
44+
"Decodes \'input\'.\n"
45+
"\n"
46+
"\'errors\' may be given to set a different error handling scheme. Default is\n"
47+
"\'strict\' meaning that encoding errors raise a UnicodeDecodeError. Other possible\n"
48+
"values are \'ignore\' and \'replace\' as well as any other name registered with\n"
49+
"codecs.register_error that is able to handle UnicodeDecodeErrors.\"");
50+
51+
#define _MULTIBYTECODEC_MULTIBYTECODEC_DECODE_METHODDEF \
52+
{"decode", (PyCFunction)_multibytecodec_MultibyteCodec_decode, METH_VARARGS|METH_KEYWORDS, _multibytecodec_MultibyteCodec_decode__doc__},
53+
54+
static PyObject *
55+
_multibytecodec_MultibyteCodec_decode_impl(MultibyteCodecObject *self, Py_buffer *input, const char *errors);
56+
57+
static PyObject *
58+
_multibytecodec_MultibyteCodec_decode(MultibyteCodecObject *self, PyObject *args, PyObject *kwargs)
59+
{
60+
PyObject *return_value = NULL;
61+
static char *_keywords[] = {"input", "errors", NULL};
62+
Py_buffer input = {NULL, NULL};
63+
const char *errors = NULL;
64+
65+
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
66+
"y*|z:decode", _keywords,
67+
&input, &errors))
68+
goto exit;
69+
return_value = _multibytecodec_MultibyteCodec_decode_impl(self, &input, errors);
70+
71+
exit:
72+
/* Cleanup for input */
73+
if (input.obj)
74+
PyBuffer_Release(&input);
75+
76+
return return_value;
77+
}
78+
79+
PyDoc_STRVAR(_multibytecodec_MultibyteIncrementalEncoder_encode__doc__,
80+
"encode($self, /, input, final=0)\n"
81+
"--");
82+
83+
#define _MULTIBYTECODEC_MULTIBYTEINCREMENTALENCODER_ENCODE_METHODDEF \
84+
{"encode", (PyCFunction)_multibytecodec_MultibyteIncrementalEncoder_encode, METH_VARARGS|METH_KEYWORDS, _multibytecodec_MultibyteIncrementalEncoder_encode__doc__},
85+
86+
static PyObject *
87+
_multibytecodec_MultibyteIncrementalEncoder_encode_impl(MultibyteIncrementalEncoderObject *self, PyObject *input, int final);
88+
89+
static PyObject *
90+
_multibytecodec_MultibyteIncrementalEncoder_encode(MultibyteIncrementalEncoderObject *self, PyObject *args, PyObject *kwargs)
91+
{
92+
PyObject *return_value = NULL;
93+
static char *_keywords[] = {"input", "final", NULL};
94+
PyObject *input;
95+
int final = 0;
96+
97+
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
98+
"O|i:encode", _keywords,
99+
&input, &final))
100+
goto exit;
101+
return_value = _multibytecodec_MultibyteIncrementalEncoder_encode_impl(self, input, final);
102+
103+
exit:
104+
return return_value;
105+
}
106+
107+
PyDoc_STRVAR(_multibytecodec_MultibyteIncrementalEncoder_reset__doc__,
108+
"reset($self, /)\n"
109+
"--");
110+
111+
#define _MULTIBYTECODEC_MULTIBYTEINCREMENTALENCODER_RESET_METHODDEF \
112+
{"reset", (PyCFunction)_multibytecodec_MultibyteIncrementalEncoder_reset, METH_NOARGS, _multibytecodec_MultibyteIncrementalEncoder_reset__doc__},
113+
114+
static PyObject *
115+
_multibytecodec_MultibyteIncrementalEncoder_reset_impl(MultibyteIncrementalEncoderObject *self);
116+
117+
static PyObject *
118+
_multibytecodec_MultibyteIncrementalEncoder_reset(MultibyteIncrementalEncoderObject *self, PyObject *Py_UNUSED(ignored))
119+
{
120+
return _multibytecodec_MultibyteIncrementalEncoder_reset_impl(self);
121+
}
122+
123+
PyDoc_STRVAR(_multibytecodec_MultibyteIncrementalDecoder_decode__doc__,
124+
"decode($self, /, input, final=0)\n"
125+
"--");
126+
127+
#define _MULTIBYTECODEC_MULTIBYTEINCREMENTALDECODER_DECODE_METHODDEF \
128+
{"decode", (PyCFunction)_multibytecodec_MultibyteIncrementalDecoder_decode, METH_VARARGS|METH_KEYWORDS, _multibytecodec_MultibyteIncrementalDecoder_decode__doc__},
129+
130+
static PyObject *
131+
_multibytecodec_MultibyteIncrementalDecoder_decode_impl(MultibyteIncrementalDecoderObject *self, Py_buffer *input, int final);
132+
133+
static PyObject *
134+
_multibytecodec_MultibyteIncrementalDecoder_decode(MultibyteIncrementalDecoderObject *self, PyObject *args, PyObject *kwargs)
135+
{
136+
PyObject *return_value = NULL;
137+
static char *_keywords[] = {"input", "final", NULL};
138+
Py_buffer input = {NULL, NULL};
139+
int final = 0;
140+
141+
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
142+
"y*|i:decode", _keywords,
143+
&input, &final))
144+
goto exit;
145+
return_value = _multibytecodec_MultibyteIncrementalDecoder_decode_impl(self, &input, final);
146+
147+
exit:
148+
/* Cleanup for input */
149+
if (input.obj)
150+
PyBuffer_Release(&input);
151+
152+
return return_value;
153+
}
154+
155+
PyDoc_STRVAR(_multibytecodec_MultibyteIncrementalDecoder_reset__doc__,
156+
"reset($self, /)\n"
157+
"--");
158+
159+
#define _MULTIBYTECODEC_MULTIBYTEINCREMENTALDECODER_RESET_METHODDEF \
160+
{"reset", (PyCFunction)_multibytecodec_MultibyteIncrementalDecoder_reset, METH_NOARGS, _multibytecodec_MultibyteIncrementalDecoder_reset__doc__},
161+
162+
static PyObject *
163+
_multibytecodec_MultibyteIncrementalDecoder_reset_impl(MultibyteIncrementalDecoderObject *self);
164+
165+
static PyObject *
166+
_multibytecodec_MultibyteIncrementalDecoder_reset(MultibyteIncrementalDecoderObject *self, PyObject *Py_UNUSED(ignored))
167+
{
168+
return _multibytecodec_MultibyteIncrementalDecoder_reset_impl(self);
169+
}
170+
171+
PyDoc_STRVAR(_multibytecodec_MultibyteStreamReader_read__doc__,
172+
"read($self, sizeobj=None, /)\n"
173+
"--");
174+
175+
#define _MULTIBYTECODEC_MULTIBYTESTREAMREADER_READ_METHODDEF \
176+
{"read", (PyCFunction)_multibytecodec_MultibyteStreamReader_read, METH_VARARGS, _multibytecodec_MultibyteStreamReader_read__doc__},
177+
178+
static PyObject *
179+
_multibytecodec_MultibyteStreamReader_read_impl(MultibyteStreamReaderObject *self, PyObject *sizeobj);
180+
181+
static PyObject *
182+
_multibytecodec_MultibyteStreamReader_read(MultibyteStreamReaderObject *self, PyObject *args)
183+
{
184+
PyObject *return_value = NULL;
185+
PyObject *sizeobj = Py_None;
186+
187+
if (!PyArg_UnpackTuple(args, "read",
188+
0, 1,
189+
&sizeobj))
190+
goto exit;
191+
return_value = _multibytecodec_MultibyteStreamReader_read_impl(self, sizeobj);
192+
193+
exit:
194+
return return_value;
195+
}
196+
197+
PyDoc_STRVAR(_multibytecodec_MultibyteStreamReader_readline__doc__,
198+
"readline($self, sizeobj=None, /)\n"
199+
"--");
200+
201+
#define _MULTIBYTECODEC_MULTIBYTESTREAMREADER_READLINE_METHODDEF \
202+
{"readline", (PyCFunction)_multibytecodec_MultibyteStreamReader_readline, METH_VARARGS, _multibytecodec_MultibyteStreamReader_readline__doc__},
203+
204+
static PyObject *
205+
_multibytecodec_MultibyteStreamReader_readline_impl(MultibyteStreamReaderObject *self, PyObject *sizeobj);
206+
207+
static PyObject *
208+
_multibytecodec_MultibyteStreamReader_readline(MultibyteStreamReaderObject *self, PyObject *args)
209+
{
210+
PyObject *return_value = NULL;
211+
PyObject *sizeobj = Py_None;
212+
213+
if (!PyArg_UnpackTuple(args, "readline",
214+
0, 1,
215+
&sizeobj))
216+
goto exit;
217+
return_value = _multibytecodec_MultibyteStreamReader_readline_impl(self, sizeobj);
218+
219+
exit:
220+
return return_value;
221+
}
222+
223+
PyDoc_STRVAR(_multibytecodec_MultibyteStreamReader_readlines__doc__,
224+
"readlines($self, sizehintobj=None, /)\n"
225+
"--");
226+
227+
#define _MULTIBYTECODEC_MULTIBYTESTREAMREADER_READLINES_METHODDEF \
228+
{"readlines", (PyCFunction)_multibytecodec_MultibyteStreamReader_readlines, METH_VARARGS, _multibytecodec_MultibyteStreamReader_readlines__doc__},
229+
230+
static PyObject *
231+
_multibytecodec_MultibyteStreamReader_readlines_impl(MultibyteStreamReaderObject *self, PyObject *sizehintobj);
232+
233+
static PyObject *
234+
_multibytecodec_MultibyteStreamReader_readlines(MultibyteStreamReaderObject *self, PyObject *args)
235+
{
236+
PyObject *return_value = NULL;
237+
PyObject *sizehintobj = Py_None;
238+
239+
if (!PyArg_UnpackTuple(args, "readlines",
240+
0, 1,
241+
&sizehintobj))
242+
goto exit;
243+
return_value = _multibytecodec_MultibyteStreamReader_readlines_impl(self, sizehintobj);
244+
245+
exit:
246+
return return_value;
247+
}
248+
249+
PyDoc_STRVAR(_multibytecodec_MultibyteStreamReader_reset__doc__,
250+
"reset($self, /)\n"
251+
"--");
252+
253+
#define _MULTIBYTECODEC_MULTIBYTESTREAMREADER_RESET_METHODDEF \
254+
{"reset", (PyCFunction)_multibytecodec_MultibyteStreamReader_reset, METH_NOARGS, _multibytecodec_MultibyteStreamReader_reset__doc__},
255+
256+
static PyObject *
257+
_multibytecodec_MultibyteStreamReader_reset_impl(MultibyteStreamReaderObject *self);
258+
259+
static PyObject *
260+
_multibytecodec_MultibyteStreamReader_reset(MultibyteStreamReaderObject *self, PyObject *Py_UNUSED(ignored))
261+
{
262+
return _multibytecodec_MultibyteStreamReader_reset_impl(self);
263+
}
264+
265+
PyDoc_STRVAR(_multibytecodec_MultibyteStreamWriter_write__doc__,
266+
"write($self, strobj, /)\n"
267+
"--");
268+
269+
#define _MULTIBYTECODEC_MULTIBYTESTREAMWRITER_WRITE_METHODDEF \
270+
{"write", (PyCFunction)_multibytecodec_MultibyteStreamWriter_write, METH_O, _multibytecodec_MultibyteStreamWriter_write__doc__},
271+
272+
PyDoc_STRVAR(_multibytecodec_MultibyteStreamWriter_writelines__doc__,
273+
"writelines($self, lines, /)\n"
274+
"--");
275+
276+
#define _MULTIBYTECODEC_MULTIBYTESTREAMWRITER_WRITELINES_METHODDEF \
277+
{"writelines", (PyCFunction)_multibytecodec_MultibyteStreamWriter_writelines, METH_O, _multibytecodec_MultibyteStreamWriter_writelines__doc__},
278+
279+
PyDoc_STRVAR(_multibytecodec_MultibyteStreamWriter_reset__doc__,
280+
"reset($self, /)\n"
281+
"--");
282+
283+
#define _MULTIBYTECODEC_MULTIBYTESTREAMWRITER_RESET_METHODDEF \
284+
{"reset", (PyCFunction)_multibytecodec_MultibyteStreamWriter_reset, METH_NOARGS, _multibytecodec_MultibyteStreamWriter_reset__doc__},
285+
286+
static PyObject *
287+
_multibytecodec_MultibyteStreamWriter_reset_impl(MultibyteStreamWriterObject *self);
288+
289+
static PyObject *
290+
_multibytecodec_MultibyteStreamWriter_reset(MultibyteStreamWriterObject *self, PyObject *Py_UNUSED(ignored))
291+
{
292+
return _multibytecodec_MultibyteStreamWriter_reset_impl(self);
293+
}
294+
295+
PyDoc_STRVAR(_multibytecodec___create_codec__doc__,
296+
"__create_codec($module, arg, /)\n"
297+
"--");
298+
299+
#define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF \
300+
{"__create_codec", (PyCFunction)_multibytecodec___create_codec, METH_O, _multibytecodec___create_codec__doc__},
301+
/*[clinic end generated code: output=dff1459dec464796 input=a9049054013a1b77]*/

0 commit comments

Comments
 (0)