mirror of
https://github.com/python/cpython.git
synced 2025-08-27 12:16:04 +00:00
Remove the deprecated and useless "pend" argument from
PyFloat_FromString. (fixes bug #1650903)
This commit is contained in:
parent
9091e3a423
commit
428f0641ec
6 changed files with 10 additions and 29 deletions
|
@ -62,24 +62,8 @@ PyFloat_FromDouble(double fval)
|
|||
return (PyObject *) op;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
RED_FLAG 22-Sep-2000 tim
|
||||
PyFloat_FromString's pend argument is braindead. Prior to this RED_FLAG,
|
||||
|
||||
1. If v was a regular string, *pend was set to point to its terminating
|
||||
null byte. That's useless (the caller can find that without any
|
||||
help from this function!).
|
||||
|
||||
2. If v was a Unicode string, or an object convertible to a character
|
||||
buffer, *pend was set to point into stack trash (the auto temp
|
||||
vector holding the character buffer). That was downright dangerous.
|
||||
|
||||
Since we can't change the interface of a public API function, pend is
|
||||
still supported but now *officially* useless: if pend is not NULL,
|
||||
*pend is set to NULL.
|
||||
**************************************************************************/
|
||||
PyObject *
|
||||
PyFloat_FromString(PyObject *v, char **pend)
|
||||
PyFloat_FromString(PyObject *v)
|
||||
{
|
||||
const char *s, *last, *end;
|
||||
double x;
|
||||
|
@ -89,8 +73,6 @@ PyFloat_FromString(PyObject *v, char **pend)
|
|||
#endif
|
||||
Py_ssize_t len;
|
||||
|
||||
if (pend)
|
||||
*pend = NULL;
|
||||
if (PyString_Check(v)) {
|
||||
s = PyString_AS_STRING(v);
|
||||
len = PyString_GET_SIZE(v);
|
||||
|
@ -852,7 +834,7 @@ float_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:float", kwlist, &x))
|
||||
return NULL;
|
||||
if (PyString_Check(x))
|
||||
return PyFloat_FromString(x, NULL);
|
||||
return PyFloat_FromString(x);
|
||||
return PyNumber_Float(x);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue