blob: 3e40a62ab0e43d19903a385e58818d26e45a2669 [file] [log] [blame]
Serhiy Storchaka1009bf12015-04-03 23:53:51 +03001/*[clinic input]
2preserve
3[clinic start generated code]*/
4
INADA Naoki3ae20562017-01-16 20:41:20 +09005PyDoc_STRVAR(unicode_title__doc__,
6"title($self, /)\n"
7"--\n"
8"\n"
INADA Naoki15f94592017-01-16 21:49:13 +09009"Return a version of the string where each word is titlecased.\n"
INADA Naoki3ae20562017-01-16 20:41:20 +090010"\n"
INADA Naoki15f94592017-01-16 21:49:13 +090011"More specifically, words start with uppercased characters and all remaining\n"
INADA Naoki3ae20562017-01-16 20:41:20 +090012"cased characters have lower case.");
13
14#define UNICODE_TITLE_METHODDEF \
15 {"title", (PyCFunction)unicode_title, METH_NOARGS, unicode_title__doc__},
16
17static PyObject *
18unicode_title_impl(PyObject *self);
19
20static PyObject *
21unicode_title(PyObject *self, PyObject *Py_UNUSED(ignored))
22{
23 return unicode_title_impl(self);
24}
25
26PyDoc_STRVAR(unicode_capitalize__doc__,
27"capitalize($self, /)\n"
28"--\n"
29"\n"
30"Return a capitalized version of the string.\n"
31"\n"
32"More specifically, make the first character have upper case and the rest lower\n"
33"case.");
34
35#define UNICODE_CAPITALIZE_METHODDEF \
36 {"capitalize", (PyCFunction)unicode_capitalize, METH_NOARGS, unicode_capitalize__doc__},
37
38static PyObject *
39unicode_capitalize_impl(PyObject *self);
40
41static PyObject *
42unicode_capitalize(PyObject *self, PyObject *Py_UNUSED(ignored))
43{
44 return unicode_capitalize_impl(self);
45}
46
47PyDoc_STRVAR(unicode_casefold__doc__,
48"casefold($self, /)\n"
49"--\n"
50"\n"
INADA Naoki15f94592017-01-16 21:49:13 +090051"Return a version of the string suitable for caseless comparisons.");
INADA Naoki3ae20562017-01-16 20:41:20 +090052
53#define UNICODE_CASEFOLD_METHODDEF \
54 {"casefold", (PyCFunction)unicode_casefold, METH_NOARGS, unicode_casefold__doc__},
55
56static PyObject *
57unicode_casefold_impl(PyObject *self);
58
59static PyObject *
60unicode_casefold(PyObject *self, PyObject *Py_UNUSED(ignored))
61{
62 return unicode_casefold_impl(self);
63}
64
65PyDoc_STRVAR(unicode_center__doc__,
66"center($self, width, fillchar=\' \', /)\n"
67"--\n"
68"\n"
69"Return a centered string of length width.\n"
70"\n"
71"Padding is done using the specified fill character (default is a space).");
72
73#define UNICODE_CENTER_METHODDEF \
Serhiy Storchaka4a934d42018-11-27 11:27:36 +020074 {"center", (PyCFunction)(void(*)(void))unicode_center, METH_FASTCALL, unicode_center__doc__},
INADA Naoki3ae20562017-01-16 20:41:20 +090075
76static PyObject *
77unicode_center_impl(PyObject *self, Py_ssize_t width, Py_UCS4 fillchar);
78
79static PyObject *
Serhiy Storchakaa5552f02017-12-15 13:11:11 +020080unicode_center(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
INADA Naoki3ae20562017-01-16 20:41:20 +090081{
82 PyObject *return_value = NULL;
83 Py_ssize_t width;
84 Py_UCS4 fillchar = ' ';
85
Serhiy Storchaka4fa95912019-01-11 16:01:14 +020086 if (!_PyArg_CheckPositional("center", nargs, 1, 2)) {
Victor Stinner259f0e42017-01-17 01:35:17 +010087 goto exit;
88 }
Serhiy Storchaka4fa95912019-01-11 16:01:14 +020089 if (PyFloat_Check(args[0])) {
90 PyErr_SetString(PyExc_TypeError,
91 "integer argument expected, got float" );
92 goto exit;
93 }
94 {
95 Py_ssize_t ival = -1;
96 PyObject *iobj = PyNumber_Index(args[0]);
97 if (iobj != NULL) {
98 ival = PyLong_AsSsize_t(iobj);
99 Py_DECREF(iobj);
100 }
101 if (ival == -1 && PyErr_Occurred()) {
102 goto exit;
103 }
104 width = ival;
105 }
106 if (nargs < 2) {
107 goto skip_optional;
108 }
109 if (!convert_uc(args[1], &fillchar)) {
110 goto exit;
111 }
112skip_optional:
INADA Naoki3ae20562017-01-16 20:41:20 +0900113 return_value = unicode_center_impl(self, width, fillchar);
114
115exit:
116 return return_value;
117}
118
119PyDoc_STRVAR(unicode_encode__doc__,
120"encode($self, /, encoding=\'utf-8\', errors=\'strict\')\n"
121"--\n"
122"\n"
INADA Naoki15f94592017-01-16 21:49:13 +0900123"Encode the string using the codec registered for encoding.\n"
INADA Naoki3ae20562017-01-16 20:41:20 +0900124"\n"
125" encoding\n"
126" The encoding in which to encode the string.\n"
127" errors\n"
INADA Naoki15f94592017-01-16 21:49:13 +0900128" The error handling scheme to use for encoding errors.\n"
INADA Naoki3ae20562017-01-16 20:41:20 +0900129" The default is \'strict\' meaning that encoding errors raise a\n"
130" UnicodeEncodeError. Other possible values are \'ignore\', \'replace\' and\n"
131" \'xmlcharrefreplace\' as well as any other name registered with\n"
132" codecs.register_error that can handle UnicodeEncodeErrors.");
133
134#define UNICODE_ENCODE_METHODDEF \
Serhiy Storchaka4a934d42018-11-27 11:27:36 +0200135 {"encode", (PyCFunction)(void(*)(void))unicode_encode, METH_FASTCALL|METH_KEYWORDS, unicode_encode__doc__},
INADA Naoki3ae20562017-01-16 20:41:20 +0900136
137static PyObject *
138unicode_encode_impl(PyObject *self, const char *encoding, const char *errors);
139
140static PyObject *
Serhiy Storchakaa5552f02017-12-15 13:11:11 +0200141unicode_encode(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
INADA Naoki3ae20562017-01-16 20:41:20 +0900142{
143 PyObject *return_value = NULL;
144 static const char * const _keywords[] = {"encoding", "errors", NULL};
145 static _PyArg_Parser _parser = {"|ss:encode", _keywords, 0};
146 const char *encoding = NULL;
147 const char *errors = NULL;
148
Victor Stinner3e1fad62017-01-17 01:29:01 +0100149 if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
INADA Naoki3ae20562017-01-16 20:41:20 +0900150 &encoding, &errors)) {
151 goto exit;
152 }
153 return_value = unicode_encode_impl(self, encoding, errors);
154
155exit:
156 return return_value;
157}
158
159PyDoc_STRVAR(unicode_expandtabs__doc__,
160"expandtabs($self, /, tabsize=8)\n"
161"--\n"
162"\n"
163"Return a copy where all tab characters are expanded using spaces.\n"
164"\n"
165"If tabsize is not given, a tab size of 8 characters is assumed.");
166
167#define UNICODE_EXPANDTABS_METHODDEF \
Serhiy Storchaka4a934d42018-11-27 11:27:36 +0200168 {"expandtabs", (PyCFunction)(void(*)(void))unicode_expandtabs, METH_FASTCALL|METH_KEYWORDS, unicode_expandtabs__doc__},
INADA Naoki3ae20562017-01-16 20:41:20 +0900169
170static PyObject *
171unicode_expandtabs_impl(PyObject *self, int tabsize);
172
173static PyObject *
Serhiy Storchakaa5552f02017-12-15 13:11:11 +0200174unicode_expandtabs(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
INADA Naoki3ae20562017-01-16 20:41:20 +0900175{
176 PyObject *return_value = NULL;
177 static const char * const _keywords[] = {"tabsize", NULL};
178 static _PyArg_Parser _parser = {"|i:expandtabs", _keywords, 0};
179 int tabsize = 8;
180
Victor Stinner3e1fad62017-01-17 01:29:01 +0100181 if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
INADA Naoki3ae20562017-01-16 20:41:20 +0900182 &tabsize)) {
183 goto exit;
184 }
185 return_value = unicode_expandtabs_impl(self, tabsize);
186
187exit:
188 return return_value;
189}
190
INADA Naokia49ac992018-01-27 14:06:21 +0900191PyDoc_STRVAR(unicode_isascii__doc__,
192"isascii($self, /)\n"
193"--\n"
194"\n"
195"Return True if all characters in the string are ASCII, False otherwise.\n"
196"\n"
197"ASCII characters have code points in the range U+0000-U+007F.\n"
198"Empty string is ASCII too.");
199
200#define UNICODE_ISASCII_METHODDEF \
201 {"isascii", (PyCFunction)unicode_isascii, METH_NOARGS, unicode_isascii__doc__},
202
203static PyObject *
204unicode_isascii_impl(PyObject *self);
205
206static PyObject *
207unicode_isascii(PyObject *self, PyObject *Py_UNUSED(ignored))
208{
209 return unicode_isascii_impl(self);
210}
211
INADA Naoki3ae20562017-01-16 20:41:20 +0900212PyDoc_STRVAR(unicode_islower__doc__,
213"islower($self, /)\n"
214"--\n"
215"\n"
INADA Naoki15f94592017-01-16 21:49:13 +0900216"Return True if the string is a lowercase string, False otherwise.\n"
INADA Naoki3ae20562017-01-16 20:41:20 +0900217"\n"
218"A string is lowercase if all cased characters in the string are lowercase and\n"
219"there is at least one cased character in the string.");
220
221#define UNICODE_ISLOWER_METHODDEF \
222 {"islower", (PyCFunction)unicode_islower, METH_NOARGS, unicode_islower__doc__},
223
224static PyObject *
225unicode_islower_impl(PyObject *self);
226
227static PyObject *
228unicode_islower(PyObject *self, PyObject *Py_UNUSED(ignored))
229{
230 return unicode_islower_impl(self);
231}
232
233PyDoc_STRVAR(unicode_isupper__doc__,
234"isupper($self, /)\n"
235"--\n"
236"\n"
INADA Naoki15f94592017-01-16 21:49:13 +0900237"Return True if the string is an uppercase string, False otherwise.\n"
INADA Naoki3ae20562017-01-16 20:41:20 +0900238"\n"
239"A string is uppercase if all cased characters in the string are uppercase and\n"
240"there is at least one cased character in the string.");
241
242#define UNICODE_ISUPPER_METHODDEF \
243 {"isupper", (PyCFunction)unicode_isupper, METH_NOARGS, unicode_isupper__doc__},
244
245static PyObject *
246unicode_isupper_impl(PyObject *self);
247
248static PyObject *
249unicode_isupper(PyObject *self, PyObject *Py_UNUSED(ignored))
250{
251 return unicode_isupper_impl(self);
252}
253
254PyDoc_STRVAR(unicode_istitle__doc__,
255"istitle($self, /)\n"
256"--\n"
257"\n"
INADA Naoki15f94592017-01-16 21:49:13 +0900258"Return True if the string is a title-cased string, False otherwise.\n"
INADA Naoki3ae20562017-01-16 20:41:20 +0900259"\n"
260"In a title-cased string, upper- and title-case characters may only\n"
261"follow uncased characters and lowercase characters only cased ones.");
262
263#define UNICODE_ISTITLE_METHODDEF \
264 {"istitle", (PyCFunction)unicode_istitle, METH_NOARGS, unicode_istitle__doc__},
265
266static PyObject *
267unicode_istitle_impl(PyObject *self);
268
269static PyObject *
270unicode_istitle(PyObject *self, PyObject *Py_UNUSED(ignored))
271{
272 return unicode_istitle_impl(self);
273}
274
275PyDoc_STRVAR(unicode_isspace__doc__,
276"isspace($self, /)\n"
277"--\n"
278"\n"
INADA Naoki15f94592017-01-16 21:49:13 +0900279"Return True if the string is a whitespace string, False otherwise.\n"
INADA Naoki3ae20562017-01-16 20:41:20 +0900280"\n"
281"A string is whitespace if all characters in the string are whitespace and there\n"
282"is at least one character in the string.");
283
284#define UNICODE_ISSPACE_METHODDEF \
285 {"isspace", (PyCFunction)unicode_isspace, METH_NOARGS, unicode_isspace__doc__},
286
287static PyObject *
288unicode_isspace_impl(PyObject *self);
289
290static PyObject *
291unicode_isspace(PyObject *self, PyObject *Py_UNUSED(ignored))
292{
293 return unicode_isspace_impl(self);
294}
295
296PyDoc_STRVAR(unicode_isalpha__doc__,
297"isalpha($self, /)\n"
298"--\n"
299"\n"
INADA Naoki15f94592017-01-16 21:49:13 +0900300"Return True if the string is an alphabetic string, False otherwise.\n"
INADA Naoki3ae20562017-01-16 20:41:20 +0900301"\n"
302"A string is alphabetic if all characters in the string are alphabetic and there\n"
303"is at least one character in the string.");
304
305#define UNICODE_ISALPHA_METHODDEF \
306 {"isalpha", (PyCFunction)unicode_isalpha, METH_NOARGS, unicode_isalpha__doc__},
307
308static PyObject *
309unicode_isalpha_impl(PyObject *self);
310
311static PyObject *
312unicode_isalpha(PyObject *self, PyObject *Py_UNUSED(ignored))
313{
314 return unicode_isalpha_impl(self);
315}
316
317PyDoc_STRVAR(unicode_isalnum__doc__,
318"isalnum($self, /)\n"
319"--\n"
320"\n"
INADA Naoki15f94592017-01-16 21:49:13 +0900321"Return True if the string is an alpha-numeric string, False otherwise.\n"
INADA Naoki3ae20562017-01-16 20:41:20 +0900322"\n"
323"A string is alpha-numeric if all characters in the string are alpha-numeric and\n"
324"there is at least one character in the string.");
325
326#define UNICODE_ISALNUM_METHODDEF \
327 {"isalnum", (PyCFunction)unicode_isalnum, METH_NOARGS, unicode_isalnum__doc__},
328
329static PyObject *
330unicode_isalnum_impl(PyObject *self);
331
332static PyObject *
333unicode_isalnum(PyObject *self, PyObject *Py_UNUSED(ignored))
334{
335 return unicode_isalnum_impl(self);
336}
337
338PyDoc_STRVAR(unicode_isdecimal__doc__,
339"isdecimal($self, /)\n"
340"--\n"
341"\n"
INADA Naoki15f94592017-01-16 21:49:13 +0900342"Return True if the string is a decimal string, False otherwise.\n"
INADA Naoki3ae20562017-01-16 20:41:20 +0900343"\n"
INADA Naoki15f94592017-01-16 21:49:13 +0900344"A string is a decimal string if all characters in the string are decimal and\n"
INADA Naoki3ae20562017-01-16 20:41:20 +0900345"there is at least one character in the string.");
346
347#define UNICODE_ISDECIMAL_METHODDEF \
348 {"isdecimal", (PyCFunction)unicode_isdecimal, METH_NOARGS, unicode_isdecimal__doc__},
349
350static PyObject *
351unicode_isdecimal_impl(PyObject *self);
352
353static PyObject *
354unicode_isdecimal(PyObject *self, PyObject *Py_UNUSED(ignored))
355{
356 return unicode_isdecimal_impl(self);
357}
358
359PyDoc_STRVAR(unicode_isdigit__doc__,
360"isdigit($self, /)\n"
361"--\n"
362"\n"
INADA Naoki15f94592017-01-16 21:49:13 +0900363"Return True if the string is a digit string, False otherwise.\n"
INADA Naoki3ae20562017-01-16 20:41:20 +0900364"\n"
365"A string is a digit string if all characters in the string are digits and there\n"
366"is at least one character in the string.");
367
368#define UNICODE_ISDIGIT_METHODDEF \
369 {"isdigit", (PyCFunction)unicode_isdigit, METH_NOARGS, unicode_isdigit__doc__},
370
371static PyObject *
372unicode_isdigit_impl(PyObject *self);
373
374static PyObject *
375unicode_isdigit(PyObject *self, PyObject *Py_UNUSED(ignored))
376{
377 return unicode_isdigit_impl(self);
378}
379
380PyDoc_STRVAR(unicode_isnumeric__doc__,
381"isnumeric($self, /)\n"
382"--\n"
383"\n"
INADA Naoki15f94592017-01-16 21:49:13 +0900384"Return True if the string is a numeric string, False otherwise.\n"
INADA Naoki3ae20562017-01-16 20:41:20 +0900385"\n"
386"A string is numeric if all characters in the string are numeric and there is at\n"
387"least one character in the string.");
388
389#define UNICODE_ISNUMERIC_METHODDEF \
390 {"isnumeric", (PyCFunction)unicode_isnumeric, METH_NOARGS, unicode_isnumeric__doc__},
391
392static PyObject *
393unicode_isnumeric_impl(PyObject *self);
394
395static PyObject *
396unicode_isnumeric(PyObject *self, PyObject *Py_UNUSED(ignored))
397{
398 return unicode_isnumeric_impl(self);
399}
400
401PyDoc_STRVAR(unicode_isidentifier__doc__,
402"isidentifier($self, /)\n"
403"--\n"
404"\n"
INADA Naoki15f94592017-01-16 21:49:13 +0900405"Return True if the string is a valid Python identifier, False otherwise.\n"
INADA Naoki3ae20562017-01-16 20:41:20 +0900406"\n"
Sanyam Khuranaffc5a142018-10-08 12:23:32 +0530407"Call keyword.iskeyword(s) to test whether string s is a reserved identifier,\n"
Emanuele Gaifasfc8205c2018-10-08 12:44:47 +0200408"such as \"def\" or \"class\".");
INADA Naoki3ae20562017-01-16 20:41:20 +0900409
410#define UNICODE_ISIDENTIFIER_METHODDEF \
411 {"isidentifier", (PyCFunction)unicode_isidentifier, METH_NOARGS, unicode_isidentifier__doc__},
412
413static PyObject *
414unicode_isidentifier_impl(PyObject *self);
415
416static PyObject *
417unicode_isidentifier(PyObject *self, PyObject *Py_UNUSED(ignored))
418{
419 return unicode_isidentifier_impl(self);
420}
421
422PyDoc_STRVAR(unicode_isprintable__doc__,
423"isprintable($self, /)\n"
424"--\n"
425"\n"
INADA Naoki15f94592017-01-16 21:49:13 +0900426"Return True if the string is printable, False otherwise.\n"
INADA Naoki3ae20562017-01-16 20:41:20 +0900427"\n"
428"A string is printable if all of its characters are considered printable in\n"
429"repr() or if it is empty.");
430
431#define UNICODE_ISPRINTABLE_METHODDEF \
432 {"isprintable", (PyCFunction)unicode_isprintable, METH_NOARGS, unicode_isprintable__doc__},
433
434static PyObject *
435unicode_isprintable_impl(PyObject *self);
436
437static PyObject *
438unicode_isprintable(PyObject *self, PyObject *Py_UNUSED(ignored))
439{
440 return unicode_isprintable_impl(self);
441}
442
443PyDoc_STRVAR(unicode_join__doc__,
444"join($self, iterable, /)\n"
445"--\n"
446"\n"
447"Concatenate any number of strings.\n"
448"\n"
Martin Panter91a88662017-01-24 00:30:06 +0000449"The string whose method is called is inserted in between each given string.\n"
INADA Naoki3ae20562017-01-16 20:41:20 +0900450"The result is returned as a new string.\n"
451"\n"
452"Example: \'.\'.join([\'ab\', \'pq\', \'rs\']) -> \'ab.pq.rs\'");
453
454#define UNICODE_JOIN_METHODDEF \
455 {"join", (PyCFunction)unicode_join, METH_O, unicode_join__doc__},
456
457PyDoc_STRVAR(unicode_ljust__doc__,
458"ljust($self, width, fillchar=\' \', /)\n"
459"--\n"
460"\n"
461"Return a left-justified string of length width.\n"
462"\n"
463"Padding is done using the specified fill character (default is a space).");
464
465#define UNICODE_LJUST_METHODDEF \
Serhiy Storchaka4a934d42018-11-27 11:27:36 +0200466 {"ljust", (PyCFunction)(void(*)(void))unicode_ljust, METH_FASTCALL, unicode_ljust__doc__},
INADA Naoki3ae20562017-01-16 20:41:20 +0900467
468static PyObject *
469unicode_ljust_impl(PyObject *self, Py_ssize_t width, Py_UCS4 fillchar);
470
471static PyObject *
Serhiy Storchakaa5552f02017-12-15 13:11:11 +0200472unicode_ljust(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
INADA Naoki3ae20562017-01-16 20:41:20 +0900473{
474 PyObject *return_value = NULL;
475 Py_ssize_t width;
476 Py_UCS4 fillchar = ' ';
477
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200478 if (!_PyArg_CheckPositional("ljust", nargs, 1, 2)) {
Victor Stinner259f0e42017-01-17 01:35:17 +0100479 goto exit;
480 }
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200481 if (PyFloat_Check(args[0])) {
482 PyErr_SetString(PyExc_TypeError,
483 "integer argument expected, got float" );
484 goto exit;
485 }
486 {
487 Py_ssize_t ival = -1;
488 PyObject *iobj = PyNumber_Index(args[0]);
489 if (iobj != NULL) {
490 ival = PyLong_AsSsize_t(iobj);
491 Py_DECREF(iobj);
492 }
493 if (ival == -1 && PyErr_Occurred()) {
494 goto exit;
495 }
496 width = ival;
497 }
498 if (nargs < 2) {
499 goto skip_optional;
500 }
501 if (!convert_uc(args[1], &fillchar)) {
502 goto exit;
503 }
504skip_optional:
INADA Naoki3ae20562017-01-16 20:41:20 +0900505 return_value = unicode_ljust_impl(self, width, fillchar);
506
507exit:
508 return return_value;
509}
510
511PyDoc_STRVAR(unicode_lower__doc__,
512"lower($self, /)\n"
513"--\n"
514"\n"
515"Return a copy of the string converted to lowercase.");
516
517#define UNICODE_LOWER_METHODDEF \
518 {"lower", (PyCFunction)unicode_lower, METH_NOARGS, unicode_lower__doc__},
519
520static PyObject *
521unicode_lower_impl(PyObject *self);
522
523static PyObject *
524unicode_lower(PyObject *self, PyObject *Py_UNUSED(ignored))
525{
526 return unicode_lower_impl(self);
527}
528
529PyDoc_STRVAR(unicode_strip__doc__,
530"strip($self, chars=None, /)\n"
531"--\n"
532"\n"
Victor Stinner0c4a8282017-01-17 02:21:47 +0100533"Return a copy of the string with leading and trailing whitespace remove.\n"
INADA Naoki3ae20562017-01-16 20:41:20 +0900534"\n"
535"If chars is given and not None, remove characters in chars instead.");
536
537#define UNICODE_STRIP_METHODDEF \
Serhiy Storchaka4a934d42018-11-27 11:27:36 +0200538 {"strip", (PyCFunction)(void(*)(void))unicode_strip, METH_FASTCALL, unicode_strip__doc__},
INADA Naoki3ae20562017-01-16 20:41:20 +0900539
540static PyObject *
541unicode_strip_impl(PyObject *self, PyObject *chars);
542
543static PyObject *
Serhiy Storchakaa5552f02017-12-15 13:11:11 +0200544unicode_strip(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
INADA Naoki3ae20562017-01-16 20:41:20 +0900545{
546 PyObject *return_value = NULL;
547 PyObject *chars = Py_None;
548
Serhiy Storchaka2a39d252019-01-11 18:01:42 +0200549 if (!_PyArg_CheckPositional("strip", nargs, 0, 1)) {
Victor Stinner0c4a8282017-01-17 02:21:47 +0100550 goto exit;
551 }
Serhiy Storchaka2a39d252019-01-11 18:01:42 +0200552 if (nargs < 1) {
553 goto skip_optional;
554 }
555 chars = args[0];
556skip_optional:
INADA Naoki3ae20562017-01-16 20:41:20 +0900557 return_value = unicode_strip_impl(self, chars);
558
559exit:
560 return return_value;
561}
562
563PyDoc_STRVAR(unicode_lstrip__doc__,
564"lstrip($self, chars=None, /)\n"
565"--\n"
566"\n"
567"Return a copy of the string with leading whitespace removed.\n"
568"\n"
569"If chars is given and not None, remove characters in chars instead.");
570
571#define UNICODE_LSTRIP_METHODDEF \
Serhiy Storchaka4a934d42018-11-27 11:27:36 +0200572 {"lstrip", (PyCFunction)(void(*)(void))unicode_lstrip, METH_FASTCALL, unicode_lstrip__doc__},
INADA Naoki3ae20562017-01-16 20:41:20 +0900573
574static PyObject *
575unicode_lstrip_impl(PyObject *self, PyObject *chars);
576
577static PyObject *
Serhiy Storchakaa5552f02017-12-15 13:11:11 +0200578unicode_lstrip(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
INADA Naoki3ae20562017-01-16 20:41:20 +0900579{
580 PyObject *return_value = NULL;
581 PyObject *chars = NULL;
582
Serhiy Storchaka2a39d252019-01-11 18:01:42 +0200583 if (!_PyArg_CheckPositional("lstrip", nargs, 0, 1)) {
Victor Stinner0c4a8282017-01-17 02:21:47 +0100584 goto exit;
585 }
Serhiy Storchaka2a39d252019-01-11 18:01:42 +0200586 if (nargs < 1) {
587 goto skip_optional;
588 }
589 chars = args[0];
590skip_optional:
INADA Naoki3ae20562017-01-16 20:41:20 +0900591 return_value = unicode_lstrip_impl(self, chars);
592
593exit:
594 return return_value;
595}
596
597PyDoc_STRVAR(unicode_rstrip__doc__,
598"rstrip($self, chars=None, /)\n"
599"--\n"
600"\n"
601"Return a copy of the string with trailing whitespace removed.\n"
602"\n"
603"If chars is given and not None, remove characters in chars instead.");
604
605#define UNICODE_RSTRIP_METHODDEF \
Serhiy Storchaka4a934d42018-11-27 11:27:36 +0200606 {"rstrip", (PyCFunction)(void(*)(void))unicode_rstrip, METH_FASTCALL, unicode_rstrip__doc__},
INADA Naoki3ae20562017-01-16 20:41:20 +0900607
608static PyObject *
609unicode_rstrip_impl(PyObject *self, PyObject *chars);
610
611static PyObject *
Serhiy Storchakaa5552f02017-12-15 13:11:11 +0200612unicode_rstrip(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
INADA Naoki3ae20562017-01-16 20:41:20 +0900613{
614 PyObject *return_value = NULL;
615 PyObject *chars = NULL;
616
Serhiy Storchaka2a39d252019-01-11 18:01:42 +0200617 if (!_PyArg_CheckPositional("rstrip", nargs, 0, 1)) {
Victor Stinner0c4a8282017-01-17 02:21:47 +0100618 goto exit;
619 }
Serhiy Storchaka2a39d252019-01-11 18:01:42 +0200620 if (nargs < 1) {
621 goto skip_optional;
622 }
623 chars = args[0];
624skip_optional:
INADA Naoki3ae20562017-01-16 20:41:20 +0900625 return_value = unicode_rstrip_impl(self, chars);
626
627exit:
628 return return_value;
629}
630
631PyDoc_STRVAR(unicode_replace__doc__,
632"replace($self, old, new, count=-1, /)\n"
633"--\n"
634"\n"
635"Return a copy with all occurrences of substring old replaced by new.\n"
636"\n"
637" count\n"
638" Maximum number of occurrences to replace.\n"
639" -1 (the default value) means replace all occurrences.\n"
640"\n"
641"If the optional argument count is given, only the first count occurrences are\n"
642"replaced.");
643
644#define UNICODE_REPLACE_METHODDEF \
Serhiy Storchaka4a934d42018-11-27 11:27:36 +0200645 {"replace", (PyCFunction)(void(*)(void))unicode_replace, METH_FASTCALL, unicode_replace__doc__},
INADA Naoki3ae20562017-01-16 20:41:20 +0900646
647static PyObject *
648unicode_replace_impl(PyObject *self, PyObject *old, PyObject *new,
649 Py_ssize_t count);
650
651static PyObject *
Serhiy Storchakaa5552f02017-12-15 13:11:11 +0200652unicode_replace(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
INADA Naoki3ae20562017-01-16 20:41:20 +0900653{
654 PyObject *return_value = NULL;
655 PyObject *old;
656 PyObject *new;
657 Py_ssize_t count = -1;
658
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200659 if (!_PyArg_CheckPositional("replace", nargs, 2, 3)) {
Victor Stinner259f0e42017-01-17 01:35:17 +0100660 goto exit;
661 }
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200662 if (!PyUnicode_Check(args[0])) {
663 _PyArg_BadArgument("replace", 1, "str", args[0]);
664 goto exit;
665 }
666 if (PyUnicode_READY(args[0]) == -1) {
667 goto exit;
668 }
669 old = args[0];
670 if (!PyUnicode_Check(args[1])) {
671 _PyArg_BadArgument("replace", 2, "str", args[1]);
672 goto exit;
673 }
674 if (PyUnicode_READY(args[1]) == -1) {
675 goto exit;
676 }
677 new = args[1];
678 if (nargs < 3) {
679 goto skip_optional;
680 }
681 if (PyFloat_Check(args[2])) {
682 PyErr_SetString(PyExc_TypeError,
683 "integer argument expected, got float" );
684 goto exit;
685 }
686 {
687 Py_ssize_t ival = -1;
688 PyObject *iobj = PyNumber_Index(args[2]);
689 if (iobj != NULL) {
690 ival = PyLong_AsSsize_t(iobj);
691 Py_DECREF(iobj);
692 }
693 if (ival == -1 && PyErr_Occurred()) {
694 goto exit;
695 }
696 count = ival;
697 }
698skip_optional:
INADA Naoki3ae20562017-01-16 20:41:20 +0900699 return_value = unicode_replace_impl(self, old, new, count);
700
701exit:
702 return return_value;
703}
704
705PyDoc_STRVAR(unicode_rjust__doc__,
706"rjust($self, width, fillchar=\' \', /)\n"
707"--\n"
708"\n"
709"Return a right-justified string of length width.\n"
710"\n"
711"Padding is done using the specified fill character (default is a space).");
712
713#define UNICODE_RJUST_METHODDEF \
Serhiy Storchaka4a934d42018-11-27 11:27:36 +0200714 {"rjust", (PyCFunction)(void(*)(void))unicode_rjust, METH_FASTCALL, unicode_rjust__doc__},
INADA Naoki3ae20562017-01-16 20:41:20 +0900715
716static PyObject *
717unicode_rjust_impl(PyObject *self, Py_ssize_t width, Py_UCS4 fillchar);
718
719static PyObject *
Serhiy Storchakaa5552f02017-12-15 13:11:11 +0200720unicode_rjust(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
INADA Naoki3ae20562017-01-16 20:41:20 +0900721{
722 PyObject *return_value = NULL;
723 Py_ssize_t width;
724 Py_UCS4 fillchar = ' ';
725
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200726 if (!_PyArg_CheckPositional("rjust", nargs, 1, 2)) {
Victor Stinner259f0e42017-01-17 01:35:17 +0100727 goto exit;
728 }
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200729 if (PyFloat_Check(args[0])) {
730 PyErr_SetString(PyExc_TypeError,
731 "integer argument expected, got float" );
732 goto exit;
733 }
734 {
735 Py_ssize_t ival = -1;
736 PyObject *iobj = PyNumber_Index(args[0]);
737 if (iobj != NULL) {
738 ival = PyLong_AsSsize_t(iobj);
739 Py_DECREF(iobj);
740 }
741 if (ival == -1 && PyErr_Occurred()) {
742 goto exit;
743 }
744 width = ival;
745 }
746 if (nargs < 2) {
747 goto skip_optional;
748 }
749 if (!convert_uc(args[1], &fillchar)) {
750 goto exit;
751 }
752skip_optional:
INADA Naoki3ae20562017-01-16 20:41:20 +0900753 return_value = unicode_rjust_impl(self, width, fillchar);
754
755exit:
756 return return_value;
757}
758
759PyDoc_STRVAR(unicode_split__doc__,
760"split($self, /, sep=None, maxsplit=-1)\n"
761"--\n"
762"\n"
763"Return a list of the words in the string, using sep as the delimiter string.\n"
764"\n"
765" sep\n"
766" The delimiter according which to split the string.\n"
767" None (the default value) means split according to any whitespace,\n"
768" and discard empty strings from the result.\n"
769" maxsplit\n"
770" Maximum number of splits to do.\n"
771" -1 (the default value) means no limit.");
772
773#define UNICODE_SPLIT_METHODDEF \
Serhiy Storchaka4a934d42018-11-27 11:27:36 +0200774 {"split", (PyCFunction)(void(*)(void))unicode_split, METH_FASTCALL|METH_KEYWORDS, unicode_split__doc__},
INADA Naoki3ae20562017-01-16 20:41:20 +0900775
776static PyObject *
777unicode_split_impl(PyObject *self, PyObject *sep, Py_ssize_t maxsplit);
778
779static PyObject *
Serhiy Storchakaa5552f02017-12-15 13:11:11 +0200780unicode_split(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
INADA Naoki3ae20562017-01-16 20:41:20 +0900781{
782 PyObject *return_value = NULL;
783 static const char * const _keywords[] = {"sep", "maxsplit", NULL};
784 static _PyArg_Parser _parser = {"|On:split", _keywords, 0};
785 PyObject *sep = Py_None;
786 Py_ssize_t maxsplit = -1;
787
Victor Stinner3e1fad62017-01-17 01:29:01 +0100788 if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
INADA Naoki3ae20562017-01-16 20:41:20 +0900789 &sep, &maxsplit)) {
790 goto exit;
791 }
792 return_value = unicode_split_impl(self, sep, maxsplit);
793
794exit:
795 return return_value;
796}
797
798PyDoc_STRVAR(unicode_partition__doc__,
799"partition($self, sep, /)\n"
800"--\n"
801"\n"
802"Partition the string into three parts using the given separator.\n"
803"\n"
804"This will search for the separator in the string. If the separator is found,\n"
805"returns a 3-tuple containing the part before the separator, the separator\n"
806"itself, and the part after it.\n"
807"\n"
808"If the separator is not found, returns a 3-tuple containing the original string\n"
809"and two empty strings.");
810
811#define UNICODE_PARTITION_METHODDEF \
812 {"partition", (PyCFunction)unicode_partition, METH_O, unicode_partition__doc__},
813
814PyDoc_STRVAR(unicode_rpartition__doc__,
815"rpartition($self, sep, /)\n"
816"--\n"
817"\n"
818"Partition the string into three parts using the given separator.\n"
819"\n"
Serhiy Storchakaa2314282017-10-29 02:11:54 +0300820"This will search for the separator in the string, starting at the end. If\n"
INADA Naoki3ae20562017-01-16 20:41:20 +0900821"the separator is found, returns a 3-tuple containing the part before the\n"
822"separator, the separator itself, and the part after it.\n"
823"\n"
824"If the separator is not found, returns a 3-tuple containing two empty strings\n"
825"and the original string.");
826
827#define UNICODE_RPARTITION_METHODDEF \
828 {"rpartition", (PyCFunction)unicode_rpartition, METH_O, unicode_rpartition__doc__},
829
830PyDoc_STRVAR(unicode_rsplit__doc__,
831"rsplit($self, /, sep=None, maxsplit=-1)\n"
832"--\n"
833"\n"
834"Return a list of the words in the string, using sep as the delimiter string.\n"
835"\n"
836" sep\n"
837" The delimiter according which to split the string.\n"
838" None (the default value) means split according to any whitespace,\n"
839" and discard empty strings from the result.\n"
840" maxsplit\n"
841" Maximum number of splits to do.\n"
842" -1 (the default value) means no limit.\n"
843"\n"
844"Splits are done starting at the end of the string and working to the front.");
845
846#define UNICODE_RSPLIT_METHODDEF \
Serhiy Storchaka4a934d42018-11-27 11:27:36 +0200847 {"rsplit", (PyCFunction)(void(*)(void))unicode_rsplit, METH_FASTCALL|METH_KEYWORDS, unicode_rsplit__doc__},
INADA Naoki3ae20562017-01-16 20:41:20 +0900848
849static PyObject *
850unicode_rsplit_impl(PyObject *self, PyObject *sep, Py_ssize_t maxsplit);
851
852static PyObject *
Serhiy Storchakaa5552f02017-12-15 13:11:11 +0200853unicode_rsplit(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
INADA Naoki3ae20562017-01-16 20:41:20 +0900854{
855 PyObject *return_value = NULL;
856 static const char * const _keywords[] = {"sep", "maxsplit", NULL};
857 static _PyArg_Parser _parser = {"|On:rsplit", _keywords, 0};
858 PyObject *sep = Py_None;
859 Py_ssize_t maxsplit = -1;
860
Victor Stinner3e1fad62017-01-17 01:29:01 +0100861 if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
INADA Naoki3ae20562017-01-16 20:41:20 +0900862 &sep, &maxsplit)) {
863 goto exit;
864 }
865 return_value = unicode_rsplit_impl(self, sep, maxsplit);
866
867exit:
868 return return_value;
869}
870
871PyDoc_STRVAR(unicode_splitlines__doc__,
872"splitlines($self, /, keepends=False)\n"
873"--\n"
874"\n"
875"Return a list of the lines in the string, breaking at line boundaries.\n"
876"\n"
877"Line breaks are not included in the resulting list unless keepends is given and\n"
878"true.");
879
880#define UNICODE_SPLITLINES_METHODDEF \
Serhiy Storchaka4a934d42018-11-27 11:27:36 +0200881 {"splitlines", (PyCFunction)(void(*)(void))unicode_splitlines, METH_FASTCALL|METH_KEYWORDS, unicode_splitlines__doc__},
INADA Naoki3ae20562017-01-16 20:41:20 +0900882
883static PyObject *
884unicode_splitlines_impl(PyObject *self, int keepends);
885
886static PyObject *
Serhiy Storchakaa5552f02017-12-15 13:11:11 +0200887unicode_splitlines(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
INADA Naoki3ae20562017-01-16 20:41:20 +0900888{
889 PyObject *return_value = NULL;
890 static const char * const _keywords[] = {"keepends", NULL};
891 static _PyArg_Parser _parser = {"|i:splitlines", _keywords, 0};
892 int keepends = 0;
893
Victor Stinner3e1fad62017-01-17 01:29:01 +0100894 if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
INADA Naoki3ae20562017-01-16 20:41:20 +0900895 &keepends)) {
896 goto exit;
897 }
898 return_value = unicode_splitlines_impl(self, keepends);
899
900exit:
901 return return_value;
902}
903
904PyDoc_STRVAR(unicode_swapcase__doc__,
905"swapcase($self, /)\n"
906"--\n"
907"\n"
908"Convert uppercase characters to lowercase and lowercase characters to uppercase.");
909
910#define UNICODE_SWAPCASE_METHODDEF \
911 {"swapcase", (PyCFunction)unicode_swapcase, METH_NOARGS, unicode_swapcase__doc__},
912
913static PyObject *
914unicode_swapcase_impl(PyObject *self);
915
916static PyObject *
917unicode_swapcase(PyObject *self, PyObject *Py_UNUSED(ignored))
918{
919 return unicode_swapcase_impl(self);
920}
921
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300922PyDoc_STRVAR(unicode_maketrans__doc__,
923"maketrans(x, y=None, z=None, /)\n"
924"--\n"
925"\n"
926"Return a translation table usable for str.translate().\n"
927"\n"
928"If there is only one argument, it must be a dictionary mapping Unicode\n"
929"ordinals (integers) or characters to Unicode ordinals, strings or None.\n"
930"Character keys will be then converted to ordinals.\n"
931"If there are two arguments, they must be strings of equal length, and\n"
932"in the resulting dictionary, each character in x will be mapped to the\n"
933"character at the same position in y. If there is a third argument, it\n"
934"must be a string, whose characters will be mapped to None in the result.");
935
936#define UNICODE_MAKETRANS_METHODDEF \
Serhiy Storchaka4a934d42018-11-27 11:27:36 +0200937 {"maketrans", (PyCFunction)(void(*)(void))unicode_maketrans, METH_FASTCALL|METH_STATIC, unicode_maketrans__doc__},
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300938
939static PyObject *
940unicode_maketrans_impl(PyObject *x, PyObject *y, PyObject *z);
941
942static PyObject *
Serhiy Storchakaa5552f02017-12-15 13:11:11 +0200943unicode_maketrans(void *null, PyObject *const *args, Py_ssize_t nargs)
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300944{
945 PyObject *return_value = NULL;
946 PyObject *x;
947 PyObject *y = NULL;
948 PyObject *z = NULL;
949
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200950 if (!_PyArg_CheckPositional("maketrans", nargs, 1, 3)) {
Victor Stinner259f0e42017-01-17 01:35:17 +0100951 goto exit;
952 }
Serhiy Storchaka4fa95912019-01-11 16:01:14 +0200953 x = args[0];
954 if (nargs < 2) {
955 goto skip_optional;
956 }
957 if (!PyUnicode_Check(args[1])) {
958 _PyArg_BadArgument("maketrans", 2, "str", args[1]);
959 goto exit;
960 }
961 if (PyUnicode_READY(args[1]) == -1) {
962 goto exit;
963 }
964 y = args[1];
965 if (nargs < 3) {
966 goto skip_optional;
967 }
968 if (!PyUnicode_Check(args[2])) {
969 _PyArg_BadArgument("maketrans", 3, "str", args[2]);
970 goto exit;
971 }
972 if (PyUnicode_READY(args[2]) == -1) {
973 goto exit;
974 }
975 z = args[2];
976skip_optional:
Serhiy Storchaka1009bf12015-04-03 23:53:51 +0300977 return_value = unicode_maketrans_impl(x, y, z);
978
979exit:
980 return return_value;
981}
INADA Naoki3ae20562017-01-16 20:41:20 +0900982
983PyDoc_STRVAR(unicode_translate__doc__,
984"translate($self, table, /)\n"
985"--\n"
986"\n"
987"Replace each character in the string using the given translation table.\n"
988"\n"
989" table\n"
990" Translation table, which must be a mapping of Unicode ordinals to\n"
991" Unicode ordinals, strings, or None.\n"
992"\n"
993"The table must implement lookup/indexing via __getitem__, for instance a\n"
994"dictionary or list. If this operation raises LookupError, the character is\n"
995"left untouched. Characters mapped to None are deleted.");
996
997#define UNICODE_TRANSLATE_METHODDEF \
998 {"translate", (PyCFunction)unicode_translate, METH_O, unicode_translate__doc__},
999
1000PyDoc_STRVAR(unicode_upper__doc__,
1001"upper($self, /)\n"
1002"--\n"
1003"\n"
1004"Return a copy of the string converted to uppercase.");
1005
1006#define UNICODE_UPPER_METHODDEF \
1007 {"upper", (PyCFunction)unicode_upper, METH_NOARGS, unicode_upper__doc__},
1008
1009static PyObject *
1010unicode_upper_impl(PyObject *self);
1011
1012static PyObject *
1013unicode_upper(PyObject *self, PyObject *Py_UNUSED(ignored))
1014{
1015 return unicode_upper_impl(self);
1016}
1017
1018PyDoc_STRVAR(unicode_zfill__doc__,
1019"zfill($self, width, /)\n"
1020"--\n"
1021"\n"
1022"Pad a numeric string with zeros on the left, to fill a field of the given width.\n"
1023"\n"
INADA Naoki15f94592017-01-16 21:49:13 +09001024"The string is never truncated.");
INADA Naoki3ae20562017-01-16 20:41:20 +09001025
1026#define UNICODE_ZFILL_METHODDEF \
1027 {"zfill", (PyCFunction)unicode_zfill, METH_O, unicode_zfill__doc__},
1028
1029static PyObject *
1030unicode_zfill_impl(PyObject *self, Py_ssize_t width);
1031
1032static PyObject *
1033unicode_zfill(PyObject *self, PyObject *arg)
1034{
1035 PyObject *return_value = NULL;
1036 Py_ssize_t width;
1037
Serhiy Storchaka32d96a22018-12-25 13:23:47 +02001038 if (PyFloat_Check(arg)) {
1039 PyErr_SetString(PyExc_TypeError,
1040 "integer argument expected, got float" );
INADA Naoki3ae20562017-01-16 20:41:20 +09001041 goto exit;
1042 }
Serhiy Storchaka32d96a22018-12-25 13:23:47 +02001043 {
1044 Py_ssize_t ival = -1;
1045 PyObject *iobj = PyNumber_Index(arg);
1046 if (iobj != NULL) {
1047 ival = PyLong_AsSsize_t(iobj);
1048 Py_DECREF(iobj);
1049 }
1050 if (ival == -1 && PyErr_Occurred()) {
1051 goto exit;
1052 }
1053 width = ival;
1054 }
INADA Naoki3ae20562017-01-16 20:41:20 +09001055 return_value = unicode_zfill_impl(self, width);
1056
1057exit:
1058 return return_value;
1059}
1060
1061PyDoc_STRVAR(unicode___format____doc__,
1062"__format__($self, format_spec, /)\n"
1063"--\n"
1064"\n"
INADA Naoki15f94592017-01-16 21:49:13 +09001065"Return a formatted version of the string as described by format_spec.");
INADA Naoki3ae20562017-01-16 20:41:20 +09001066
1067#define UNICODE___FORMAT___METHODDEF \
1068 {"__format__", (PyCFunction)unicode___format__, METH_O, unicode___format____doc__},
1069
1070static PyObject *
1071unicode___format___impl(PyObject *self, PyObject *format_spec);
1072
1073static PyObject *
1074unicode___format__(PyObject *self, PyObject *arg)
1075{
1076 PyObject *return_value = NULL;
1077 PyObject *format_spec;
1078
Serhiy Storchaka32d96a22018-12-25 13:23:47 +02001079 if (!PyUnicode_Check(arg)) {
Serhiy Storchaka4fa95912019-01-11 16:01:14 +02001080 _PyArg_BadArgument("__format__", 0, "str", arg);
INADA Naoki3ae20562017-01-16 20:41:20 +09001081 goto exit;
1082 }
Serhiy Storchaka32d96a22018-12-25 13:23:47 +02001083 if (PyUnicode_READY(arg) == -1) {
1084 goto exit;
1085 }
1086 format_spec = arg;
INADA Naoki3ae20562017-01-16 20:41:20 +09001087 return_value = unicode___format___impl(self, format_spec);
1088
1089exit:
1090 return return_value;
1091}
1092
1093PyDoc_STRVAR(unicode_sizeof__doc__,
1094"__sizeof__($self, /)\n"
1095"--\n"
1096"\n"
1097"Return the size of the string in memory, in bytes.");
1098
1099#define UNICODE_SIZEOF_METHODDEF \
1100 {"__sizeof__", (PyCFunction)unicode_sizeof, METH_NOARGS, unicode_sizeof__doc__},
1101
1102static PyObject *
1103unicode_sizeof_impl(PyObject *self);
1104
1105static PyObject *
1106unicode_sizeof(PyObject *self, PyObject *Py_UNUSED(ignored))
1107{
1108 return unicode_sizeof_impl(self);
1109}
Serhiy Storchaka2a39d252019-01-11 18:01:42 +02001110/*[clinic end generated code: output=087ff163a10505ae input=a9049054013a1b77]*/