summaryrefslogtreecommitdiffstats
path: root/Modules/selectmodule.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2002-07-28 15:12:10 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2002-07-28 15:12:10 (GMT)
commit77c72bb3236757ea0cf9bc8bc1c3f7ec28de777a (patch)
tree9ed70a8fa5d9e426967f9a6604f7e326fbfd3191 /Modules/selectmodule.c
parent4ddfd50d859fc16d9fa1b969c3760923dfb86617 (diff)
downloadcpython-77c72bb3236757ea0cf9bc8bc1c3f7ec28de777a.zip
cpython-77c72bb3236757ea0cf9bc8bc1c3f7ec28de777a.tar.gz
cpython-77c72bb3236757ea0cf9bc8bc1c3f7ec28de777a.tar.bz2
SF patch #577031, remove PyArg_Parse() since it's deprecated
Diffstat (limited to 'Modules/selectmodule.c')
-rw-r--r--Modules/selectmodule.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
index 4149dc5..2caa022 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -208,12 +208,17 @@ select_select(PyObject *self, PyObject *args)
if (tout == Py_None)
tvp = (struct timeval *)0;
- else if (!PyArg_Parse(tout, "d", &timeout)) {
+ else if (!PyNumber_Check(tout)) {
PyErr_SetString(PyExc_TypeError,
"timeout must be a float or None");
return NULL;
}
else {
+ tout = PyNumber_Float(tout);
+ if (!tout)
+ return NULL;
+ timeout = PyFloat_AS_DOUBLE(tout);
+ Py_DECREF(tout);
if (timeout > (double)LONG_MAX) {
PyErr_SetString(PyExc_OverflowError,
"timeout period too long");
@@ -450,11 +455,18 @@ poll_poll(pollObject *self, PyObject *args)
/* Check values for timeout */
if (tout == NULL || tout == Py_None)
timeout = -1;
- else if (!PyArg_Parse(tout, "i", &timeout)) {
+ else if (!PyNumber_Check(tout)) {
PyErr_SetString(PyExc_TypeError,
"timeout must be an integer or None");
return NULL;
}
+ else {
+ tout = PyNumber_Int(tout);
+ if (!tout)
+ return NULL;
+ timeout = PyInt_AS_LONG(tout);
+ Py_DECREF(tout);
+ }
/* Ensure the ufd array is up to date */
if (!self->ufd_uptodate)