diff options
Diffstat (limited to 'Objects/floatobject.c')
-rw-r--r-- | Objects/floatobject.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c index e77b2dc..2ef4d1a 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -1533,7 +1533,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 (PyUnicode_Check(x)) + /* If it's a string, but not a string subclass, use + PyFloat_FromString. */ + if (PyUnicode_CheckExact(x)) return PyFloat_FromString(x); return PyNumber_Float(x); } |