mirror of
https://github.com/python/cpython.git
synced 2025-07-30 06:34:15 +00:00
parent
5c9914899b
commit
99d36f1563
3 changed files with 17 additions and 1 deletions
|
@ -1630,7 +1630,9 @@ float_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
return float_subtype_new(type, args, kwds); /* Wimp out */
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:float", kwlist, &x))
|
||||
return NULL;
|
||||
if (PyString_Check(x))
|
||||
/* If it's a string, but not a string subclass, use
|
||||
PyFloat_FromString. */
|
||||
if (PyString_CheckExact(x))
|
||||
return PyFloat_FromString(x, NULL);
|
||||
return PyNumber_Float(x);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue