Mercurial > cpython-lru_cache-weakref
diff Objects/floatobject.c @ 47294:4fe192d48960 legacy-trunk
Renamed PyString to PyBytes
| author | Christian Heimes <christian@cheimes.de> |
|---|---|
| date | Mon, 26 May 2008 12:51:38 +0000 |
| parents | 8baeba13ae93 |
| children | 47ef9a806ce9 |
line wrap: on
line diff
--- a/Objects/floatobject.c Mon May 26 12:29:46 2008 +0000 +++ b/Objects/floatobject.c Mon May 26 12:51:38 2008 +0000 @@ -185,9 +185,9 @@ if (pend) *pend = NULL; - if (PyString_Check(v)) { - s = PyString_AS_STRING(v); - len = PyString_GET_SIZE(v); + if (PyBytes_Check(v)) { + s = PyBytes_AS_STRING(v); + len = PyBytes_GET_SIZE(v); } #ifdef Py_USING_UNICODE else if (PyUnicode_Check(v)) { @@ -488,7 +488,7 @@ char buf[100]; format_float(buf, sizeof(buf), v, PREC_REPR); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } static PyObject * @@ -496,7 +496,7 @@ { char buf[100]; format_float(buf, sizeof(buf), v, PREC_STR); - return PyString_FromString(buf); + return PyBytes_FromString(buf); } /* Comparison is pretty much a nightmare. When comparing float to float, @@ -1221,7 +1221,7 @@ 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 (PyBytes_Check(x)) return PyFloat_FromString(x, NULL); return PyNumber_Float(x); } @@ -1272,13 +1272,13 @@ char* s; float_format_type r; - if (!PyString_Check(arg)) { + if (!PyBytes_Check(arg)) { PyErr_Format(PyExc_TypeError, "__getformat__() argument must be string, not %.500s", Py_TYPE(arg)->tp_name); return NULL; } - s = PyString_AS_STRING(arg); + s = PyBytes_AS_STRING(arg); if (strcmp(s, "double") == 0) { r = double_format; } @@ -1294,11 +1294,11 @@ switch (r) { case unknown_format: - return PyString_FromString("unknown"); + return PyBytes_FromString("unknown"); case ieee_little_endian_format: - return PyString_FromString("IEEE, little-endian"); + return PyBytes_FromString("IEEE, little-endian"); case ieee_big_endian_format: - return PyString_FromString("IEEE, big-endian"); + return PyBytes_FromString("IEEE, big-endian"); default: Py_FatalError("insane float_format or double_format"); return NULL; @@ -1397,7 +1397,7 @@ if (!PyArg_ParseTuple(args, "O:__format__", &format_spec)) return NULL; - if (PyString_Check(format_spec)) + if (PyBytes_Check(format_spec)) return string_float__format__(self, args); if (PyUnicode_Check(format_spec)) { /* Convert format_spec to a str */
