mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
SF patch #577031, remove PyArg_Parse() since it's deprecated
This commit is contained in:
parent
4ddfd50d85
commit
77c72bb323
1 changed files with 14 additions and 2 deletions
|
@ -208,12 +208,17 @@ select_select(PyObject *self, PyObject *args)
|
||||||
|
|
||||||
if (tout == Py_None)
|
if (tout == Py_None)
|
||||||
tvp = (struct timeval *)0;
|
tvp = (struct timeval *)0;
|
||||||
else if (!PyArg_Parse(tout, "d", &timeout)) {
|
else if (!PyNumber_Check(tout)) {
|
||||||
PyErr_SetString(PyExc_TypeError,
|
PyErr_SetString(PyExc_TypeError,
|
||||||
"timeout must be a float or None");
|
"timeout must be a float or None");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
tout = PyNumber_Float(tout);
|
||||||
|
if (!tout)
|
||||||
|
return NULL;
|
||||||
|
timeout = PyFloat_AS_DOUBLE(tout);
|
||||||
|
Py_DECREF(tout);
|
||||||
if (timeout > (double)LONG_MAX) {
|
if (timeout > (double)LONG_MAX) {
|
||||||
PyErr_SetString(PyExc_OverflowError,
|
PyErr_SetString(PyExc_OverflowError,
|
||||||
"timeout period too long");
|
"timeout period too long");
|
||||||
|
@ -450,11 +455,18 @@ poll_poll(pollObject *self, PyObject *args)
|
||||||
/* Check values for timeout */
|
/* Check values for timeout */
|
||||||
if (tout == NULL || tout == Py_None)
|
if (tout == NULL || tout == Py_None)
|
||||||
timeout = -1;
|
timeout = -1;
|
||||||
else if (!PyArg_Parse(tout, "i", &timeout)) {
|
else if (!PyNumber_Check(tout)) {
|
||||||
PyErr_SetString(PyExc_TypeError,
|
PyErr_SetString(PyExc_TypeError,
|
||||||
"timeout must be an integer or None");
|
"timeout must be an integer or None");
|
||||||
return NULL;
|
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 */
|
/* Ensure the ufd array is up to date */
|
||||||
if (!self->ufd_uptodate)
|
if (!self->ufd_uptodate)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue