diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2019-01-11 14:01:14 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-11 14:01:14 (GMT) |
commit | 4fa9591025b6a098f3d6402e5413ee6740ede6c5 (patch) | |
tree | a81280fdd40c6a5b8c00613b0a8903624499afc5 /Modules/clinic/resource.c.h | |
parent | 5485085b324a45307c1ff4ec7d85b5998d7d5e0d (diff) | |
download | cpython-4fa9591025b6a098f3d6402e5413ee6740ede6c5.zip cpython-4fa9591025b6a098f3d6402e5413ee6740ede6c5.tar.gz cpython-4fa9591025b6a098f3d6402e5413ee6740ede6c5.tar.bz2 |
bpo-35582: Argument Clinic: inline parsing code for positional parameters. (GH-11313)
Diffstat (limited to 'Modules/clinic/resource.c.h')
-rw-r--r-- | Modules/clinic/resource.c.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Modules/clinic/resource.c.h b/Modules/clinic/resource.c.h index 0a66f8f..80efb71 100644 --- a/Modules/clinic/resource.c.h +++ b/Modules/clinic/resource.c.h @@ -84,10 +84,19 @@ resource_setrlimit(PyObject *module, PyObject *const *args, Py_ssize_t nargs) int resource; PyObject *limits; - if (!_PyArg_ParseStack(args, nargs, "iO:setrlimit", - &resource, &limits)) { + if (!_PyArg_CheckPositional("setrlimit", nargs, 2, 2)) { goto exit; } + if (PyFloat_Check(args[0])) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float" ); + goto exit; + } + resource = _PyLong_AsInt(args[0]); + if (resource == -1 && PyErr_Occurred()) { + goto exit; + } + limits = args[1]; return_value = resource_setrlimit_impl(module, resource, limits); exit: @@ -169,4 +178,4 @@ exit: #ifndef RESOURCE_PRLIMIT_METHODDEF #define RESOURCE_PRLIMIT_METHODDEF #endif /* !defined(RESOURCE_PRLIMIT_METHODDEF) */ -/*[clinic end generated code: output=b16a9149639081fd input=a9049054013a1b77]*/ +/*[clinic end generated code: output=ef3034f291156a34 input=a9049054013a1b77]*/ |