/src/cpython/Modules/clinic/_localemodule.c.h
Line | Count | Source (jump to first uncovered line) |
1 | | /*[clinic input] |
2 | | preserve |
3 | | [clinic start generated code]*/ |
4 | | |
5 | | #include "pycore_modsupport.h" // _PyArg_CheckPositional() |
6 | | |
7 | | PyDoc_STRVAR(_locale_setlocale__doc__, |
8 | | "setlocale($module, category, locale=<unrepresentable>, /)\n" |
9 | | "--\n" |
10 | | "\n" |
11 | | "Activates/queries locale processing."); |
12 | | |
13 | | #define _LOCALE_SETLOCALE_METHODDEF \ |
14 | | {"setlocale", _PyCFunction_CAST(_locale_setlocale), METH_FASTCALL, _locale_setlocale__doc__}, |
15 | | |
16 | | static PyObject * |
17 | | _locale_setlocale_impl(PyObject *module, int category, const char *locale); |
18 | | |
19 | | static PyObject * |
20 | | _locale_setlocale(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
21 | 0 | { |
22 | 0 | PyObject *return_value = NULL; |
23 | 0 | int category; |
24 | 0 | const char *locale = NULL; |
25 | |
|
26 | 0 | if (!_PyArg_CheckPositional("setlocale", nargs, 1, 2)) { |
27 | 0 | goto exit; |
28 | 0 | } |
29 | 0 | category = PyLong_AsInt(args[0]); |
30 | 0 | if (category == -1 && PyErr_Occurred()) { |
31 | 0 | goto exit; |
32 | 0 | } |
33 | 0 | if (nargs < 2) { |
34 | 0 | goto skip_optional; |
35 | 0 | } |
36 | 0 | if (args[1] == Py_None) { |
37 | 0 | locale = NULL; |
38 | 0 | } |
39 | 0 | else if (PyUnicode_Check(args[1])) { |
40 | 0 | Py_ssize_t locale_length; |
41 | 0 | locale = PyUnicode_AsUTF8AndSize(args[1], &locale_length); |
42 | 0 | if (locale == NULL) { |
43 | 0 | goto exit; |
44 | 0 | } |
45 | 0 | if (strlen(locale) != (size_t)locale_length) { |
46 | 0 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
47 | 0 | goto exit; |
48 | 0 | } |
49 | 0 | } |
50 | 0 | else { |
51 | 0 | _PyArg_BadArgument("setlocale", "argument 2", "str or None", args[1]); |
52 | 0 | goto exit; |
53 | 0 | } |
54 | 0 | skip_optional: |
55 | 0 | return_value = _locale_setlocale_impl(module, category, locale); |
56 | |
|
57 | 0 | exit: |
58 | 0 | return return_value; |
59 | 0 | } |
60 | | |
61 | | PyDoc_STRVAR(_locale_localeconv__doc__, |
62 | | "localeconv($module, /)\n" |
63 | | "--\n" |
64 | | "\n" |
65 | | "Returns numeric and monetary locale-specific parameters."); |
66 | | |
67 | | #define _LOCALE_LOCALECONV_METHODDEF \ |
68 | | {"localeconv", (PyCFunction)_locale_localeconv, METH_NOARGS, _locale_localeconv__doc__}, |
69 | | |
70 | | static PyObject * |
71 | | _locale_localeconv_impl(PyObject *module); |
72 | | |
73 | | static PyObject * |
74 | | _locale_localeconv(PyObject *module, PyObject *Py_UNUSED(ignored)) |
75 | 0 | { |
76 | 0 | return _locale_localeconv_impl(module); |
77 | 0 | } |
78 | | |
79 | | #if defined(HAVE_WCSCOLL) |
80 | | |
81 | | PyDoc_STRVAR(_locale_strcoll__doc__, |
82 | | "strcoll($module, os1, os2, /)\n" |
83 | | "--\n" |
84 | | "\n" |
85 | | "Compares two strings according to the locale."); |
86 | | |
87 | | #define _LOCALE_STRCOLL_METHODDEF \ |
88 | | {"strcoll", _PyCFunction_CAST(_locale_strcoll), METH_FASTCALL, _locale_strcoll__doc__}, |
89 | | |
90 | | static PyObject * |
91 | | _locale_strcoll_impl(PyObject *module, PyObject *os1, PyObject *os2); |
92 | | |
93 | | static PyObject * |
94 | | _locale_strcoll(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
95 | 0 | { |
96 | 0 | PyObject *return_value = NULL; |
97 | 0 | PyObject *os1; |
98 | 0 | PyObject *os2; |
99 | |
|
100 | 0 | if (!_PyArg_CheckPositional("strcoll", nargs, 2, 2)) { |
101 | 0 | goto exit; |
102 | 0 | } |
103 | 0 | if (!PyUnicode_Check(args[0])) { |
104 | 0 | _PyArg_BadArgument("strcoll", "argument 1", "str", args[0]); |
105 | 0 | goto exit; |
106 | 0 | } |
107 | 0 | os1 = args[0]; |
108 | 0 | if (!PyUnicode_Check(args[1])) { |
109 | 0 | _PyArg_BadArgument("strcoll", "argument 2", "str", args[1]); |
110 | 0 | goto exit; |
111 | 0 | } |
112 | 0 | os2 = args[1]; |
113 | 0 | return_value = _locale_strcoll_impl(module, os1, os2); |
114 | |
|
115 | 0 | exit: |
116 | 0 | return return_value; |
117 | 0 | } |
118 | | |
119 | | #endif /* defined(HAVE_WCSCOLL) */ |
120 | | |
121 | | #if defined(HAVE_WCSXFRM) |
122 | | |
123 | | PyDoc_STRVAR(_locale_strxfrm__doc__, |
124 | | "strxfrm($module, string, /)\n" |
125 | | "--\n" |
126 | | "\n" |
127 | | "Return a string that can be used as a key for locale-aware comparisons."); |
128 | | |
129 | | #define _LOCALE_STRXFRM_METHODDEF \ |
130 | | {"strxfrm", (PyCFunction)_locale_strxfrm, METH_O, _locale_strxfrm__doc__}, |
131 | | |
132 | | static PyObject * |
133 | | _locale_strxfrm_impl(PyObject *module, PyObject *str); |
134 | | |
135 | | static PyObject * |
136 | | _locale_strxfrm(PyObject *module, PyObject *arg) |
137 | 0 | { |
138 | 0 | PyObject *return_value = NULL; |
139 | 0 | PyObject *str; |
140 | |
|
141 | 0 | if (!PyUnicode_Check(arg)) { |
142 | 0 | _PyArg_BadArgument("strxfrm", "argument", "str", arg); |
143 | 0 | goto exit; |
144 | 0 | } |
145 | 0 | str = arg; |
146 | 0 | return_value = _locale_strxfrm_impl(module, str); |
147 | |
|
148 | 0 | exit: |
149 | 0 | return return_value; |
150 | 0 | } |
151 | | |
152 | | #endif /* defined(HAVE_WCSXFRM) */ |
153 | | |
154 | | #if defined(MS_WINDOWS) |
155 | | |
156 | | PyDoc_STRVAR(_locale__getdefaultlocale__doc__, |
157 | | "_getdefaultlocale($module, /)\n" |
158 | | "--\n" |
159 | | "\n"); |
160 | | |
161 | | #define _LOCALE__GETDEFAULTLOCALE_METHODDEF \ |
162 | | {"_getdefaultlocale", (PyCFunction)_locale__getdefaultlocale, METH_NOARGS, _locale__getdefaultlocale__doc__}, |
163 | | |
164 | | static PyObject * |
165 | | _locale__getdefaultlocale_impl(PyObject *module); |
166 | | |
167 | | static PyObject * |
168 | | _locale__getdefaultlocale(PyObject *module, PyObject *Py_UNUSED(ignored)) |
169 | | { |
170 | | return _locale__getdefaultlocale_impl(module); |
171 | | } |
172 | | |
173 | | #endif /* defined(MS_WINDOWS) */ |
174 | | |
175 | | #if defined(HAVE_LANGINFO_H) |
176 | | |
177 | | PyDoc_STRVAR(_locale_nl_langinfo__doc__, |
178 | | "nl_langinfo($module, key, /)\n" |
179 | | "--\n" |
180 | | "\n" |
181 | | "Return the value for the locale information associated with key."); |
182 | | |
183 | | #define _LOCALE_NL_LANGINFO_METHODDEF \ |
184 | | {"nl_langinfo", (PyCFunction)_locale_nl_langinfo, METH_O, _locale_nl_langinfo__doc__}, |
185 | | |
186 | | static PyObject * |
187 | | _locale_nl_langinfo_impl(PyObject *module, int item); |
188 | | |
189 | | static PyObject * |
190 | | _locale_nl_langinfo(PyObject *module, PyObject *arg) |
191 | 0 | { |
192 | 0 | PyObject *return_value = NULL; |
193 | 0 | int item; |
194 | |
|
195 | 0 | item = PyLong_AsInt(arg); |
196 | 0 | if (item == -1 && PyErr_Occurred()) { |
197 | 0 | goto exit; |
198 | 0 | } |
199 | 0 | return_value = _locale_nl_langinfo_impl(module, item); |
200 | |
|
201 | 0 | exit: |
202 | 0 | return return_value; |
203 | 0 | } |
204 | | |
205 | | #endif /* defined(HAVE_LANGINFO_H) */ |
206 | | |
207 | | #if defined(HAVE_LIBINTL_H) |
208 | | |
209 | | PyDoc_STRVAR(_locale_gettext__doc__, |
210 | | "gettext($module, msg, /)\n" |
211 | | "--\n" |
212 | | "\n" |
213 | | "gettext(msg) -> string\n" |
214 | | "\n" |
215 | | "Return translation of msg."); |
216 | | |
217 | | #define _LOCALE_GETTEXT_METHODDEF \ |
218 | | {"gettext", (PyCFunction)_locale_gettext, METH_O, _locale_gettext__doc__}, |
219 | | |
220 | | static PyObject * |
221 | | _locale_gettext_impl(PyObject *module, const char *in); |
222 | | |
223 | | static PyObject * |
224 | | _locale_gettext(PyObject *module, PyObject *arg) |
225 | 0 | { |
226 | 0 | PyObject *return_value = NULL; |
227 | 0 | const char *in; |
228 | |
|
229 | 0 | if (!PyUnicode_Check(arg)) { |
230 | 0 | _PyArg_BadArgument("gettext", "argument", "str", arg); |
231 | 0 | goto exit; |
232 | 0 | } |
233 | 0 | Py_ssize_t in_length; |
234 | 0 | in = PyUnicode_AsUTF8AndSize(arg, &in_length); |
235 | 0 | if (in == NULL) { |
236 | 0 | goto exit; |
237 | 0 | } |
238 | 0 | if (strlen(in) != (size_t)in_length) { |
239 | 0 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
240 | 0 | goto exit; |
241 | 0 | } |
242 | 0 | return_value = _locale_gettext_impl(module, in); |
243 | |
|
244 | 0 | exit: |
245 | 0 | return return_value; |
246 | 0 | } |
247 | | |
248 | | #endif /* defined(HAVE_LIBINTL_H) */ |
249 | | |
250 | | #if defined(HAVE_LIBINTL_H) |
251 | | |
252 | | PyDoc_STRVAR(_locale_dgettext__doc__, |
253 | | "dgettext($module, domain, msg, /)\n" |
254 | | "--\n" |
255 | | "\n" |
256 | | "dgettext(domain, msg) -> string\n" |
257 | | "\n" |
258 | | "Return translation of msg in domain."); |
259 | | |
260 | | #define _LOCALE_DGETTEXT_METHODDEF \ |
261 | | {"dgettext", _PyCFunction_CAST(_locale_dgettext), METH_FASTCALL, _locale_dgettext__doc__}, |
262 | | |
263 | | static PyObject * |
264 | | _locale_dgettext_impl(PyObject *module, const char *domain, const char *in); |
265 | | |
266 | | static PyObject * |
267 | | _locale_dgettext(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
268 | 0 | { |
269 | 0 | PyObject *return_value = NULL; |
270 | 0 | const char *domain; |
271 | 0 | const char *in; |
272 | |
|
273 | 0 | if (!_PyArg_CheckPositional("dgettext", nargs, 2, 2)) { |
274 | 0 | goto exit; |
275 | 0 | } |
276 | 0 | if (args[0] == Py_None) { |
277 | 0 | domain = NULL; |
278 | 0 | } |
279 | 0 | else if (PyUnicode_Check(args[0])) { |
280 | 0 | Py_ssize_t domain_length; |
281 | 0 | domain = PyUnicode_AsUTF8AndSize(args[0], &domain_length); |
282 | 0 | if (domain == NULL) { |
283 | 0 | goto exit; |
284 | 0 | } |
285 | 0 | if (strlen(domain) != (size_t)domain_length) { |
286 | 0 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
287 | 0 | goto exit; |
288 | 0 | } |
289 | 0 | } |
290 | 0 | else { |
291 | 0 | _PyArg_BadArgument("dgettext", "argument 1", "str or None", args[0]); |
292 | 0 | goto exit; |
293 | 0 | } |
294 | 0 | if (!PyUnicode_Check(args[1])) { |
295 | 0 | _PyArg_BadArgument("dgettext", "argument 2", "str", args[1]); |
296 | 0 | goto exit; |
297 | 0 | } |
298 | 0 | Py_ssize_t in_length; |
299 | 0 | in = PyUnicode_AsUTF8AndSize(args[1], &in_length); |
300 | 0 | if (in == NULL) { |
301 | 0 | goto exit; |
302 | 0 | } |
303 | 0 | if (strlen(in) != (size_t)in_length) { |
304 | 0 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
305 | 0 | goto exit; |
306 | 0 | } |
307 | 0 | return_value = _locale_dgettext_impl(module, domain, in); |
308 | |
|
309 | 0 | exit: |
310 | 0 | return return_value; |
311 | 0 | } |
312 | | |
313 | | #endif /* defined(HAVE_LIBINTL_H) */ |
314 | | |
315 | | #if defined(HAVE_LIBINTL_H) |
316 | | |
317 | | PyDoc_STRVAR(_locale_dcgettext__doc__, |
318 | | "dcgettext($module, domain, msg, category, /)\n" |
319 | | "--\n" |
320 | | "\n" |
321 | | "Return translation of msg in domain and category."); |
322 | | |
323 | | #define _LOCALE_DCGETTEXT_METHODDEF \ |
324 | | {"dcgettext", _PyCFunction_CAST(_locale_dcgettext), METH_FASTCALL, _locale_dcgettext__doc__}, |
325 | | |
326 | | static PyObject * |
327 | | _locale_dcgettext_impl(PyObject *module, const char *domain, |
328 | | const char *msgid, int category); |
329 | | |
330 | | static PyObject * |
331 | | _locale_dcgettext(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
332 | 0 | { |
333 | 0 | PyObject *return_value = NULL; |
334 | 0 | const char *domain; |
335 | 0 | const char *msgid; |
336 | 0 | int category; |
337 | |
|
338 | 0 | if (!_PyArg_CheckPositional("dcgettext", nargs, 3, 3)) { |
339 | 0 | goto exit; |
340 | 0 | } |
341 | 0 | if (args[0] == Py_None) { |
342 | 0 | domain = NULL; |
343 | 0 | } |
344 | 0 | else if (PyUnicode_Check(args[0])) { |
345 | 0 | Py_ssize_t domain_length; |
346 | 0 | domain = PyUnicode_AsUTF8AndSize(args[0], &domain_length); |
347 | 0 | if (domain == NULL) { |
348 | 0 | goto exit; |
349 | 0 | } |
350 | 0 | if (strlen(domain) != (size_t)domain_length) { |
351 | 0 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
352 | 0 | goto exit; |
353 | 0 | } |
354 | 0 | } |
355 | 0 | else { |
356 | 0 | _PyArg_BadArgument("dcgettext", "argument 1", "str or None", args[0]); |
357 | 0 | goto exit; |
358 | 0 | } |
359 | 0 | if (!PyUnicode_Check(args[1])) { |
360 | 0 | _PyArg_BadArgument("dcgettext", "argument 2", "str", args[1]); |
361 | 0 | goto exit; |
362 | 0 | } |
363 | 0 | Py_ssize_t msgid_length; |
364 | 0 | msgid = PyUnicode_AsUTF8AndSize(args[1], &msgid_length); |
365 | 0 | if (msgid == NULL) { |
366 | 0 | goto exit; |
367 | 0 | } |
368 | 0 | if (strlen(msgid) != (size_t)msgid_length) { |
369 | 0 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
370 | 0 | goto exit; |
371 | 0 | } |
372 | 0 | category = PyLong_AsInt(args[2]); |
373 | 0 | if (category == -1 && PyErr_Occurred()) { |
374 | 0 | goto exit; |
375 | 0 | } |
376 | 0 | return_value = _locale_dcgettext_impl(module, domain, msgid, category); |
377 | |
|
378 | 0 | exit: |
379 | 0 | return return_value; |
380 | 0 | } |
381 | | |
382 | | #endif /* defined(HAVE_LIBINTL_H) */ |
383 | | |
384 | | #if defined(HAVE_LIBINTL_H) |
385 | | |
386 | | PyDoc_STRVAR(_locale_textdomain__doc__, |
387 | | "textdomain($module, domain, /)\n" |
388 | | "--\n" |
389 | | "\n" |
390 | | "Set the C library\'s textdmain to domain, returning the new domain."); |
391 | | |
392 | | #define _LOCALE_TEXTDOMAIN_METHODDEF \ |
393 | | {"textdomain", (PyCFunction)_locale_textdomain, METH_O, _locale_textdomain__doc__}, |
394 | | |
395 | | static PyObject * |
396 | | _locale_textdomain_impl(PyObject *module, const char *domain); |
397 | | |
398 | | static PyObject * |
399 | | _locale_textdomain(PyObject *module, PyObject *arg) |
400 | 0 | { |
401 | 0 | PyObject *return_value = NULL; |
402 | 0 | const char *domain; |
403 | |
|
404 | 0 | if (arg == Py_None) { |
405 | 0 | domain = NULL; |
406 | 0 | } |
407 | 0 | else if (PyUnicode_Check(arg)) { |
408 | 0 | Py_ssize_t domain_length; |
409 | 0 | domain = PyUnicode_AsUTF8AndSize(arg, &domain_length); |
410 | 0 | if (domain == NULL) { |
411 | 0 | goto exit; |
412 | 0 | } |
413 | 0 | if (strlen(domain) != (size_t)domain_length) { |
414 | 0 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
415 | 0 | goto exit; |
416 | 0 | } |
417 | 0 | } |
418 | 0 | else { |
419 | 0 | _PyArg_BadArgument("textdomain", "argument", "str or None", arg); |
420 | 0 | goto exit; |
421 | 0 | } |
422 | 0 | return_value = _locale_textdomain_impl(module, domain); |
423 | |
|
424 | 0 | exit: |
425 | 0 | return return_value; |
426 | 0 | } |
427 | | |
428 | | #endif /* defined(HAVE_LIBINTL_H) */ |
429 | | |
430 | | #if defined(HAVE_LIBINTL_H) |
431 | | |
432 | | PyDoc_STRVAR(_locale_bindtextdomain__doc__, |
433 | | "bindtextdomain($module, domain, dir, /)\n" |
434 | | "--\n" |
435 | | "\n" |
436 | | "Bind the C library\'s domain to dir."); |
437 | | |
438 | | #define _LOCALE_BINDTEXTDOMAIN_METHODDEF \ |
439 | | {"bindtextdomain", _PyCFunction_CAST(_locale_bindtextdomain), METH_FASTCALL, _locale_bindtextdomain__doc__}, |
440 | | |
441 | | static PyObject * |
442 | | _locale_bindtextdomain_impl(PyObject *module, const char *domain, |
443 | | PyObject *dirname_obj); |
444 | | |
445 | | static PyObject * |
446 | | _locale_bindtextdomain(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
447 | 0 | { |
448 | 0 | PyObject *return_value = NULL; |
449 | 0 | const char *domain; |
450 | 0 | PyObject *dirname_obj; |
451 | |
|
452 | 0 | if (!_PyArg_CheckPositional("bindtextdomain", nargs, 2, 2)) { |
453 | 0 | goto exit; |
454 | 0 | } |
455 | 0 | if (!PyUnicode_Check(args[0])) { |
456 | 0 | _PyArg_BadArgument("bindtextdomain", "argument 1", "str", args[0]); |
457 | 0 | goto exit; |
458 | 0 | } |
459 | 0 | Py_ssize_t domain_length; |
460 | 0 | domain = PyUnicode_AsUTF8AndSize(args[0], &domain_length); |
461 | 0 | if (domain == NULL) { |
462 | 0 | goto exit; |
463 | 0 | } |
464 | 0 | if (strlen(domain) != (size_t)domain_length) { |
465 | 0 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
466 | 0 | goto exit; |
467 | 0 | } |
468 | 0 | dirname_obj = args[1]; |
469 | 0 | return_value = _locale_bindtextdomain_impl(module, domain, dirname_obj); |
470 | |
|
471 | 0 | exit: |
472 | 0 | return return_value; |
473 | 0 | } |
474 | | |
475 | | #endif /* defined(HAVE_LIBINTL_H) */ |
476 | | |
477 | | #if defined(HAVE_LIBINTL_H) && defined(HAVE_BIND_TEXTDOMAIN_CODESET) |
478 | | |
479 | | PyDoc_STRVAR(_locale_bind_textdomain_codeset__doc__, |
480 | | "bind_textdomain_codeset($module, domain, codeset, /)\n" |
481 | | "--\n" |
482 | | "\n" |
483 | | "Bind the C library\'s domain to codeset."); |
484 | | |
485 | | #define _LOCALE_BIND_TEXTDOMAIN_CODESET_METHODDEF \ |
486 | | {"bind_textdomain_codeset", _PyCFunction_CAST(_locale_bind_textdomain_codeset), METH_FASTCALL, _locale_bind_textdomain_codeset__doc__}, |
487 | | |
488 | | static PyObject * |
489 | | _locale_bind_textdomain_codeset_impl(PyObject *module, const char *domain, |
490 | | const char *codeset); |
491 | | |
492 | | static PyObject * |
493 | | _locale_bind_textdomain_codeset(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
494 | 0 | { |
495 | 0 | PyObject *return_value = NULL; |
496 | 0 | const char *domain; |
497 | 0 | const char *codeset; |
498 | |
|
499 | 0 | if (!_PyArg_CheckPositional("bind_textdomain_codeset", nargs, 2, 2)) { |
500 | 0 | goto exit; |
501 | 0 | } |
502 | 0 | if (!PyUnicode_Check(args[0])) { |
503 | 0 | _PyArg_BadArgument("bind_textdomain_codeset", "argument 1", "str", args[0]); |
504 | 0 | goto exit; |
505 | 0 | } |
506 | 0 | Py_ssize_t domain_length; |
507 | 0 | domain = PyUnicode_AsUTF8AndSize(args[0], &domain_length); |
508 | 0 | if (domain == NULL) { |
509 | 0 | goto exit; |
510 | 0 | } |
511 | 0 | if (strlen(domain) != (size_t)domain_length) { |
512 | 0 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
513 | 0 | goto exit; |
514 | 0 | } |
515 | 0 | if (args[1] == Py_None) { |
516 | 0 | codeset = NULL; |
517 | 0 | } |
518 | 0 | else if (PyUnicode_Check(args[1])) { |
519 | 0 | Py_ssize_t codeset_length; |
520 | 0 | codeset = PyUnicode_AsUTF8AndSize(args[1], &codeset_length); |
521 | 0 | if (codeset == NULL) { |
522 | 0 | goto exit; |
523 | 0 | } |
524 | 0 | if (strlen(codeset) != (size_t)codeset_length) { |
525 | 0 | PyErr_SetString(PyExc_ValueError, "embedded null character"); |
526 | 0 | goto exit; |
527 | 0 | } |
528 | 0 | } |
529 | 0 | else { |
530 | 0 | _PyArg_BadArgument("bind_textdomain_codeset", "argument 2", "str or None", args[1]); |
531 | 0 | goto exit; |
532 | 0 | } |
533 | 0 | return_value = _locale_bind_textdomain_codeset_impl(module, domain, codeset); |
534 | |
|
535 | 0 | exit: |
536 | 0 | return return_value; |
537 | 0 | } |
538 | | |
539 | | #endif /* defined(HAVE_LIBINTL_H) && defined(HAVE_BIND_TEXTDOMAIN_CODESET) */ |
540 | | |
541 | | PyDoc_STRVAR(_locale_getencoding__doc__, |
542 | | "getencoding($module, /)\n" |
543 | | "--\n" |
544 | | "\n" |
545 | | "Get the current locale encoding."); |
546 | | |
547 | | #define _LOCALE_GETENCODING_METHODDEF \ |
548 | | {"getencoding", (PyCFunction)_locale_getencoding, METH_NOARGS, _locale_getencoding__doc__}, |
549 | | |
550 | | static PyObject * |
551 | | _locale_getencoding_impl(PyObject *module); |
552 | | |
553 | | static PyObject * |
554 | | _locale_getencoding(PyObject *module, PyObject *Py_UNUSED(ignored)) |
555 | 0 | { |
556 | 0 | return _locale_getencoding_impl(module); |
557 | 0 | } |
558 | | |
559 | | #ifndef _LOCALE_STRCOLL_METHODDEF |
560 | | #define _LOCALE_STRCOLL_METHODDEF |
561 | | #endif /* !defined(_LOCALE_STRCOLL_METHODDEF) */ |
562 | | |
563 | | #ifndef _LOCALE_STRXFRM_METHODDEF |
564 | | #define _LOCALE_STRXFRM_METHODDEF |
565 | | #endif /* !defined(_LOCALE_STRXFRM_METHODDEF) */ |
566 | | |
567 | | #ifndef _LOCALE__GETDEFAULTLOCALE_METHODDEF |
568 | | #define _LOCALE__GETDEFAULTLOCALE_METHODDEF |
569 | | #endif /* !defined(_LOCALE__GETDEFAULTLOCALE_METHODDEF) */ |
570 | | |
571 | | #ifndef _LOCALE_NL_LANGINFO_METHODDEF |
572 | | #define _LOCALE_NL_LANGINFO_METHODDEF |
573 | | #endif /* !defined(_LOCALE_NL_LANGINFO_METHODDEF) */ |
574 | | |
575 | | #ifndef _LOCALE_GETTEXT_METHODDEF |
576 | | #define _LOCALE_GETTEXT_METHODDEF |
577 | | #endif /* !defined(_LOCALE_GETTEXT_METHODDEF) */ |
578 | | |
579 | | #ifndef _LOCALE_DGETTEXT_METHODDEF |
580 | | #define _LOCALE_DGETTEXT_METHODDEF |
581 | | #endif /* !defined(_LOCALE_DGETTEXT_METHODDEF) */ |
582 | | |
583 | | #ifndef _LOCALE_DCGETTEXT_METHODDEF |
584 | | #define _LOCALE_DCGETTEXT_METHODDEF |
585 | | #endif /* !defined(_LOCALE_DCGETTEXT_METHODDEF) */ |
586 | | |
587 | | #ifndef _LOCALE_TEXTDOMAIN_METHODDEF |
588 | | #define _LOCALE_TEXTDOMAIN_METHODDEF |
589 | | #endif /* !defined(_LOCALE_TEXTDOMAIN_METHODDEF) */ |
590 | | |
591 | | #ifndef _LOCALE_BINDTEXTDOMAIN_METHODDEF |
592 | | #define _LOCALE_BINDTEXTDOMAIN_METHODDEF |
593 | | #endif /* !defined(_LOCALE_BINDTEXTDOMAIN_METHODDEF) */ |
594 | | |
595 | | #ifndef _LOCALE_BIND_TEXTDOMAIN_CODESET_METHODDEF |
596 | | #define _LOCALE_BIND_TEXTDOMAIN_CODESET_METHODDEF |
597 | | #endif /* !defined(_LOCALE_BIND_TEXTDOMAIN_CODESET_METHODDEF) */ |
598 | | /*[clinic end generated code: output=034a3c219466d207 input=a9049054013a1b77]*/ |