summaryrefslogtreecommitdiffstats
path: root/Objects/floatobject.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-04-15 21:46:14 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-04-15 21:46:14 (GMT)
commitc843a4765a63098b7cb67a1a38627e39c382d369 (patch)
tree442719abf461eec98e06e5dd2feb2a89c7b6ca06 /Objects/floatobject.c
parent8b18e2853bac5bf0061ea9ab677e7ae843223ef6 (diff)
downloadcpython-c843a4765a63098b7cb67a1a38627e39c382d369.zip
cpython-c843a4765a63098b7cb67a1a38627e39c382d369.tar.gz
cpython-c843a4765a63098b7cb67a1a38627e39c382d369.tar.bz2
Merged revisions 71627 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r71627 | benjamin.peterson | 2009-04-15 16:26:36 -0500 (Wed, 15 Apr 2009) | 4 lines call __float__ on str subclasses #5759 tests by R. David Murray ........
Diffstat (limited to 'Objects/floatobject.c')
-rw-r--r--Objects/floatobject.c4
1 files changed, 3 insertions, 1 deletions
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 @@ 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);
}