Vajrasky Kok added the comment: With little modification:
class PID_converter(int_converter): type = 'pid_t' format_unit = '" _Py_PARSE_PID "' It works. Thanks! But I got unnecessary empty string: if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "i:prlimit", &pid, &resource)) It should be: if (!PyArg_ParseTuple(args, _Py_PARSE_PID "i:prlimit", &pid, &resource)) Anyway, that is trivial problem. Now I hit a hard one. How do you convert this signature? - if (!PyArg_ParseTuple(args, _Py_PARSE_PID "i|(OO):prlimit", - &pid, &resource, &curobj, &maxobj)) I create custom converters: +class TupleOpen_converter(object_converter): + format_unit = '(O' +class TupleClose_converter(object_converter): + format_unit = 'O)' and +/*[clinic input] +resource.prlimit + + pid: PID + resource: int + [ + curobj: TupleOpen + maxobj: TupleClose + ] + / +[clinic start generated code]*/ But I got invalid argument size in the generated code. + case 2: + if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "i:prlimit", &pid, &resource)) + return NULL; + break; + case 4: ========> should be "case 3:" + if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "i(OO):prlimit", &pid, &resource, &curobj, &maxobj)) + return NULL; + group_right_1 = 1; + break; + default: + PyErr_SetString(PyExc_TypeError, "resource.prlimit requires 2 to 4 arguments"); =======> should be "2 to 3 arguments" + return NULL; Any idea, Larry? ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20185> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com