summaryrefslogtreecommitdiff
path: root/Objects/floatobject.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-04-15 21:34:27 +0000
committerBenjamin Peterson <benjamin@python.org>2009-04-15 21:34:27 +0000
commit2808d3c41847ba1f8e07ee678742b6f12528face (patch)
treece0ca8f56fa2bcba75bae34c0eca30cb54505dd4 /Objects/floatobject.c
parent50a14695573807aebdeea1c7c057b816b1bbd4a3 (diff)
downloadcpython-git-2808d3c41847ba1f8e07ee678742b6f12528face.tar.gz
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 e77b2dc855..2ef4d1a865 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);
}