summaryrefslogtreecommitdiffstats
path: root/Modules/clinic/fcntlmodule.c.h
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/clinic/fcntlmodule.c.h')
-rw-r--r--Modules/clinic/fcntlmodule.c.h100
1 files changed, 91 insertions, 9 deletions
diff --git a/Modules/clinic/fcntlmodule.c.h b/Modules/clinic/fcntlmodule.c.h
index 7b5a280..024a44c 100644
--- a/Modules/clinic/fcntlmodule.c.h
+++ b/Modules/clinic/fcntlmodule.c.h
@@ -32,10 +32,26 @@ fcntl_fcntl(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
int code;
PyObject *arg = NULL;
- if (!_PyArg_ParseStack(args, nargs, "O&i|O:fcntl",
- conv_descriptor, &fd, &code, &arg)) {
+ if (!_PyArg_CheckPositional("fcntl", nargs, 2, 3)) {
goto exit;
}
+ if (!conv_descriptor(args[0], &fd)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ code = _PyLong_AsInt(args[1]);
+ if (code == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (nargs < 3) {
+ goto skip_optional;
+ }
+ arg = args[2];
+skip_optional:
return_value = fcntl_fcntl_impl(module, fd, code, arg);
exit:
@@ -91,10 +107,33 @@ fcntl_ioctl(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *ob_arg = NULL;
int mutate_arg = 1;
- if (!_PyArg_ParseStack(args, nargs, "O&I|Op:ioctl",
- conv_descriptor, &fd, &code, &ob_arg, &mutate_arg)) {
+ if (!_PyArg_CheckPositional("ioctl", nargs, 2, 4)) {
+ goto exit;
+ }
+ if (!conv_descriptor(args[0], &fd)) {
goto exit;
}
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ code = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
+ if (code == (unsigned int)-1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (nargs < 3) {
+ goto skip_optional;
+ }
+ ob_arg = args[2];
+ if (nargs < 4) {
+ goto skip_optional;
+ }
+ mutate_arg = PyObject_IsTrue(args[3]);
+ if (mutate_arg < 0) {
+ goto exit;
+ }
+skip_optional:
return_value = fcntl_ioctl_impl(module, fd, code, ob_arg, mutate_arg);
exit:
@@ -123,8 +162,19 @@ fcntl_flock(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
int fd;
int code;
- if (!_PyArg_ParseStack(args, nargs, "O&i:flock",
- conv_descriptor, &fd, &code)) {
+ if (!_PyArg_CheckPositional("flock", nargs, 2, 2)) {
+ goto exit;
+ }
+ if (!conv_descriptor(args[0], &fd)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ code = _PyLong_AsInt(args[1]);
+ if (code == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = fcntl_flock_impl(module, fd, code);
@@ -177,13 +227,45 @@ fcntl_lockf(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *startobj = NULL;
int whence = 0;
- if (!_PyArg_ParseStack(args, nargs, "O&i|OOi:lockf",
- conv_descriptor, &fd, &code, &lenobj, &startobj, &whence)) {
+ if (!_PyArg_CheckPositional("lockf", nargs, 2, 5)) {
+ goto exit;
+ }
+ if (!conv_descriptor(args[0], &fd)) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ code = _PyLong_AsInt(args[1]);
+ if (code == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (nargs < 3) {
+ goto skip_optional;
+ }
+ lenobj = args[2];
+ if (nargs < 4) {
+ goto skip_optional;
+ }
+ startobj = args[3];
+ if (nargs < 5) {
+ goto skip_optional;
+ }
+ if (PyFloat_Check(args[4])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ whence = _PyLong_AsInt(args[4]);
+ if (whence == -1 && PyErr_Occurred()) {
goto exit;
}
+skip_optional:
return_value = fcntl_lockf_impl(module, fd, code, lenobj, startobj, whence);
exit:
return return_value;
}
-/*[clinic end generated code: output=fc1a781750750a14 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=e912d25e28362c52 input=a9049054013a1b77]*/