Mercurial > cpython-lru_cache-weakref
diff Objects/floatobject.c @ 53162:6bcdc131f53c 2.6
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:46:14 +0000 |
| parents | 2e794757bdc8 |
| children | 35c6d407d3c9 6947bc3dd433 |
line wrap: on
line diff
--- a/Objects/floatobject.c Wed Apr 15 19:44:57 2009 +0000 +++ b/Objects/floatobject.c Wed Apr 15 21:46:14 2009 +0000 @@ -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); }
