Skip to content

Commit 6a8f1f1

Browse files
Remove else`s.
1 parent 36b524e commit 6a8f1f1

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

Modules/fcntlmodule.c

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ fcntl_fcntl_impl(PyObject *module, int fd, int code, PyObject *arg)
7979
}
8080
return PyLong_FromLong(ret);
8181
}
82-
else if (PyUnicode_Check(arg) || PyObject_CheckBuffer(arg)) {
82+
if (PyUnicode_Check(arg) || PyObject_CheckBuffer(arg)) {
8383
#define FCNTL_BUFSZ 1024
8484
Py_buffer view;
8585
char buf[FCNTL_BUFSZ+1]; /* argument plus NUL byte */
@@ -109,13 +109,11 @@ fcntl_fcntl_impl(PyObject *module, int fd, int code, PyObject *arg)
109109
return PyBytes_FromStringAndSize(buf, len);
110110
#undef FCNTL_BUFSZ
111111
}
112-
else {
113-
PyErr_Format(PyExc_TypeError,
114-
"fcntl() argument 3 must be an integer, "
115-
"a bytes-like object, or a string, not %T",
116-
arg);
117-
return NULL;
118-
}
112+
PyErr_Format(PyExc_TypeError,
113+
"fcntl() argument 3 must be an integer, "
114+
"a bytes-like object, or a string, not %T",
115+
arg);
116+
return NULL;
119117
}
120118

121119

@@ -198,7 +196,7 @@ fcntl_ioctl_impl(PyObject *module, int fd, unsigned long code, PyObject *arg,
198196
}
199197
return PyLong_FromLong(ret);
200198
}
201-
else if (PyUnicode_Check(arg) || PyObject_CheckBuffer(arg)) {
199+
if (PyUnicode_Check(arg) || PyObject_CheckBuffer(arg)) {
202200
Py_buffer view;
203201
#define IOCTL_BUFSZ 1024
204202
char buf[IOCTL_BUFSZ+1]; /* argument plus NUL byte */
@@ -262,13 +260,11 @@ fcntl_ioctl_impl(PyObject *module, int fd, unsigned long code, PyObject *arg,
262260
return PyBytes_FromStringAndSize(buf, len);
263261
#undef IOCTL_BUFSZ
264262
}
265-
else {
266-
PyErr_Format(PyExc_TypeError,
267-
"ioctl() argument 3 must be an integer, "
268-
"a bytes-like object, or a string, not %T",
269-
arg);
270-
return NULL;
271-
}
263+
PyErr_Format(PyExc_TypeError,
264+
"ioctl() argument 3 must be an integer, "
265+
"a bytes-like object, or a string, not %T",
266+
arg);
267+
return NULL;
272268
}
273269

274270
/*[clinic input]

0 commit comments

Comments
 (0)