summaryrefslogtreecommitdiffstats
path: root/Modules/clinic/selectmodule.c.h
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-12-25 11:23:47 (GMT)
committerGitHub <noreply@github.com>2018-12-25 11:23:47 (GMT)
commit32d96a2b5bc3136d45a66adbdb45fac351b520ce (patch)
treeacf51c9945f764ab103597c9cba376f154aa600d /Modules/clinic/selectmodule.c.h
parent65ce60aef150776f884715b4315a10a0d6ae769e (diff)
downloadcpython-32d96a2b5bc3136d45a66adbdb45fac351b520ce.zip
cpython-32d96a2b5bc3136d45a66adbdb45fac351b520ce.tar.gz
cpython-32d96a2b5bc3136d45a66adbdb45fac351b520ce.tar.bz2
bpo-23867: Argument Clinic: inline parsing code for a single positional parameter. (GH-9689)
Diffstat (limited to 'Modules/clinic/selectmodule.c.h')
-rw-r--r--Modules/clinic/selectmodule.c.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/Modules/clinic/selectmodule.c.h b/Modules/clinic/selectmodule.c.h
index 0a53ae2..bb69d95 100644
--- a/Modules/clinic/selectmodule.c.h
+++ b/Modules/clinic/selectmodule.c.h
@@ -153,7 +153,7 @@ select_poll_unregister(pollObject *self, PyObject *arg)
PyObject *return_value = NULL;
int fd;
- if (!PyArg_Parse(arg, "O&:unregister", fildes_converter, &fd)) {
+ if (!fildes_converter(arg, &fd)) {
goto exit;
}
return_value = select_poll_unregister_impl(self, fd);
@@ -300,7 +300,7 @@ select_devpoll_unregister(devpollObject *self, PyObject *arg)
PyObject *return_value = NULL;
int fd;
- if (!PyArg_Parse(arg, "O&:unregister", fildes_converter, &fd)) {
+ if (!fildes_converter(arg, &fd)) {
goto exit;
}
return_value = select_devpoll_unregister_impl(self, fd);
@@ -550,7 +550,13 @@ select_epoll_fromfd(PyTypeObject *type, PyObject *arg)
PyObject *return_value = NULL;
int fd;
- if (!PyArg_Parse(arg, "i:fromfd", &fd)) {
+ if (PyFloat_Check(arg)) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd = _PyLong_AsInt(arg);
+ if (fd == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = select_epoll_fromfd_impl(type, fd);
@@ -893,7 +899,13 @@ select_kqueue_fromfd(PyTypeObject *type, PyObject *arg)
PyObject *return_value = NULL;
int fd;
- if (!PyArg_Parse(arg, "i:fromfd", &fd)) {
+ if (PyFloat_Check(arg)) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ fd = _PyLong_AsInt(arg);
+ if (fd == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = select_kqueue_fromfd_impl(type, fd);
@@ -1047,4 +1059,4 @@ exit:
#ifndef SELECT_KQUEUE_CONTROL_METHODDEF
#define SELECT_KQUEUE_CONTROL_METHODDEF
#endif /* !defined(SELECT_KQUEUE_CONTROL_METHODDEF) */
-/*[clinic end generated code: output=04c4019eb5a4d464 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=122a49f131cdd9d9 input=a9049054013a1b77]*/