+++ /dev/null
-Fix ``fcntl.ioctl()`` *request* parameter: use an ``unsigned long`` instead of
-an ``unsigned int`` for the *request* parameter of :func:`fcntl.ioctl` to
-support requests larger than ``UINT_MAX``. Patch by Victor Stinner.
{"ioctl", _PyCFunction_CAST(fcntl_ioctl), METH_FASTCALL, fcntl_ioctl__doc__},
static PyObject *
-fcntl_ioctl_impl(PyObject *module, int fd, unsigned long code,
+fcntl_ioctl_impl(PyObject *module, int fd, unsigned int code,
PyObject *ob_arg, int mutate_arg);
static PyObject *
{
PyObject *return_value = NULL;
int fd;
- unsigned long code;
+ unsigned int code;
PyObject *ob_arg = NULL;
int mutate_arg = 1;
if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
goto exit;
}
- if (!PyLong_Check(args[1])) {
- _PyArg_BadArgument("ioctl", "argument 2", "int", args[1]);
+ code = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
+ if (code == (unsigned int)-1 && PyErr_Occurred()) {
goto exit;
}
- code = PyLong_AsUnsignedLongMask(args[1]);
if (nargs < 3) {
goto skip_optional;
}
exit:
return return_value;
}
-/*[clinic end generated code: output=4362fb678c9c5447 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=1db859412172dd53 input=a9049054013a1b77]*/
fcntl.ioctl
fd: fildes
- request as code: unsigned_long(bitwise=True)
+ request as code: unsigned_int(bitwise=True)
arg as ob_arg: object(c_default='NULL') = 0
mutate_flag as mutate_arg: bool = True
/
[clinic start generated code]*/
static PyObject *
-fcntl_ioctl_impl(PyObject *module, int fd, unsigned long code,
+fcntl_ioctl_impl(PyObject *module, int fd, unsigned int code,
PyObject *ob_arg, int mutate_arg)
-/*[clinic end generated code: output=3d8eb6828666cea1 input=cee70f6a27311e58]*/
+/*[clinic end generated code: output=7f7f5840c65991be input=967b4a4cbeceb0a8]*/
{
#define IOCTL_BUFSZ 1024
/* We use the unsigned non-checked 'I' format for the 'code' parameter