summaryrefslogtreecommitdiffstats
path: root/Objects/floatobject.c
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2008-06-09 04:58:54 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2008-06-09 04:58:54 (GMT)
commitdd96db63f689e2f0d8ae5a1436b3b3395eec7de5 (patch)
treeb2299acac9ce44fc488fc7b2ae2a44548cd5fbb8 /Objects/floatobject.c
parente98839a1f48b2915f1cc747884e64f4d6e4c8e7a (diff)
downloadcpython-dd96db63f689e2f0d8ae5a1436b3b3395eec7de5.zip
cpython-dd96db63f689e2f0d8ae5a1436b3b3395eec7de5.tar.gz
cpython-dd96db63f689e2f0d8ae5a1436b3b3395eec7de5.tar.bz2
This reverts r63675 based on the discussion in this thread:
http://mail.python.org/pipermail/python-dev/2008-June/079988.html Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names in the spirit of 3.0 are available via a #define only. See the email thread.
Diffstat (limited to 'Objects/floatobject.c')
-rw-r--r--Objects/floatobject.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index baf55aa..32e7cc8 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -182,9 +182,9 @@ PyFloat_FromString(PyObject *v, char **pend)
if (pend)
*pend = NULL;
- if (PyBytes_Check(v)) {
- s = PyBytes_AS_STRING(v);
- len = PyBytes_GET_SIZE(v);
+ if (PyString_Check(v)) {
+ s = PyString_AS_STRING(v);
+ len = PyString_GET_SIZE(v);
}
#ifdef Py_USING_UNICODE
else if (PyUnicode_Check(v)) {
@@ -485,7 +485,7 @@ float_repr(PyFloatObject *v)
char buf[100];
format_float(buf, sizeof(buf), v, PREC_REPR);
- return PyBytes_FromString(buf);
+ return PyString_FromString(buf);
}
static PyObject *
@@ -493,7 +493,7 @@ float_str(PyFloatObject *v)
{
char buf[100];
format_float(buf, sizeof(buf), v, PREC_STR);
- return PyBytes_FromString(buf);
+ return PyString_FromString(buf);
}
/* Comparison is pretty much a nightmare. When comparing float to float,
@@ -1218,7 +1218,7 @@ 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 (PyBytes_Check(x))
+ if (PyString_Check(x))
return PyFloat_FromString(x, NULL);
return PyNumber_Float(x);
}
@@ -1269,13 +1269,13 @@ float_getformat(PyTypeObject *v, PyObject* arg)
char* s;
float_format_type r;
- if (!PyBytes_Check(arg)) {
+ if (!PyString_Check(arg)) {
PyErr_Format(PyExc_TypeError,
"__getformat__() argument must be string, not %.500s",
Py_TYPE(arg)->tp_name);
return NULL;
}
- s = PyBytes_AS_STRING(arg);
+ s = PyString_AS_STRING(arg);
if (strcmp(s, "double") == 0) {
r = double_format;
}
@@ -1291,11 +1291,11 @@ float_getformat(PyTypeObject *v, PyObject* arg)
switch (r) {
case unknown_format:
- return PyBytes_FromString("unknown");
+ return PyString_FromString("unknown");
case ieee_little_endian_format:
- return PyBytes_FromString("IEEE, little-endian");
+ return PyString_FromString("IEEE, little-endian");
case ieee_big_endian_format:
- return PyBytes_FromString("IEEE, big-endian");
+ return PyString_FromString("IEEE, big-endian");
default:
Py_FatalError("insane float_format or double_format");
return NULL;