diff Objects/floatobject.c @ 53161:df2638b9bee2 3.0

Merged revisions 71628 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r71628 | benjamin.peterson | 2009-04-15 16:34:27 -0500 (Wed, 15 Apr 2009) | 11 lines 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 ........ ................
author Benjamin Peterson <benjamin@python.org>
date Wed, 15 Apr 2009 21:40:50 +0000
parents 87fbbf22adf3
children e9edcaf42547
line wrap: on
line diff
--- a/Objects/floatobject.c	Tue Apr 14 08:00:41 2009 +0000
+++ b/Objects/floatobject.c	Wed Apr 15 21:40:50 2009 +0000
@@ -1533,7 +1533,9 @@
 		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);
 }