call __float__ on str subclasses #5759
tests by R. David Murray
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index 881671c..4f041f4 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -1630,7 +1630,9 @@
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);
}