Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 1 | /*[clinic input] |
| 2 | preserve |
| 3 | [clinic start generated code]*/ |
| 4 | |
| 5 | PyDoc_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 | |
| 22 | static PyObject * |
| 23 | unicode_maketrans_impl(PyObject *x, PyObject *y, PyObject *z); |
| 24 | |
| 25 | static PyObject * |
| 26 | unicode_maketrans(void *null, PyObject *args) |
| 27 | { |
| 28 | PyObject *return_value = NULL; |
| 29 | PyObject *x; |
| 30 | PyObject *y = NULL; |
| 31 | PyObject *z = NULL; |
| 32 | |
Serhiy Storchaka | 247789c | 2015-04-24 00:40:51 +0300 | [diff] [blame] | 33 | if (!PyArg_ParseTuple(args, "O|UU:maketrans", |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 34 | &x, &y, &z)) { |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 35 | goto exit; |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 36 | } |
Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame] | 37 | return_value = unicode_maketrans_impl(x, y, z); |
| 38 | |
| 39 | exit: |
| 40 | return return_value; |
| 41 | } |
Serhiy Storchaka | 5dee655 | 2016-06-09 16:16:06 +0300 | [diff] [blame] | 42 | /*[clinic end generated code: output=4a86dd108d92d104 input=a9049054013a1b77]*/ |