blob: d42a70002a9cb6b6e3af4dd6499095114df5ee08 [file] [log] [blame]
Serhiy Storchaka1009bf12015-04-03 23:53:51 +03001/*[clinic input]
2preserve
3[clinic start generated code]*/
4
5PyDoc_STRVAR(unicode_maketrans__doc__,
6"maketrans(x, y=None, z=None, /)\n"
7"--\n"
8"\n"
9"Return a translation table usable for str.translate().\n"
10"\n"
11"If there is only one argument, it must be a dictionary mapping Unicode\n"
12"ordinals (integers) or characters to Unicode ordinals, strings or None.\n"
13"Character keys will be then converted to ordinals.\n"
14"If there are two arguments, they must be strings of equal length, and\n"
15"in the resulting dictionary, each character in x will be mapped to the\n"
16"character at the same position in y. If there is a third argument, it\n"
17"must be a string, whose characters will be mapped to None in the result.");
18
19#define UNICODE_MAKETRANS_METHODDEF \
20 {"maketrans", (PyCFunction)unicode_maketrans, METH_VARARGS|METH_STATIC, unicode_maketrans__doc__},
21
22static PyObject *
23unicode_maketrans_impl(PyObject *x, PyObject *y, PyObject *z);
24
25static PyObject *
26unicode_maketrans(void *null, PyObject *args)
27{
28 PyObject *return_value = NULL;
29 PyObject *x;
30 PyObject *y = NULL;
31 PyObject *z = NULL;
32
Serhiy Storchaka247789c2015-04-24 00:40:51 +030033 if (!PyArg_ParseTuple(args, "O|UU:maketrans",
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030034 &x, &y, &z))
35 goto exit;
36 return_value = unicode_maketrans_impl(x, y, z);
37
38exit:
39 return return_value;
40}
Serhiy Storchaka247789c2015-04-24 00:40:51 +030041/*[clinic end generated code: output=94affdff5b2daff5 input=a9049054013a1b77]*/