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.
diff --git a/Objects/complexobject.c b/Objects/complexobject.c
index 6110b99..9943d0d 100644
--- a/Objects/complexobject.c
+++ b/Objects/complexobject.c
@@ -303,7 +303,7 @@
cv.imag = 0.;
if (complex_str == NULL) {
- if (!(complex_str = PyBytes_InternFromString("__complex__")))
+ if (!(complex_str = PyString_InternFromString("__complex__")))
return cv;
}
@@ -421,7 +421,7 @@
{
char buf[100];
complex_to_buf(buf, sizeof(buf), v, PREC_REPR);
- return PyBytes_FromString(buf);
+ return PyString_FromString(buf);
}
static PyObject *
@@ -429,7 +429,7 @@
{
char buf[100];
complex_to_buf(buf, sizeof(buf), v, PREC_STR);
- return PyBytes_FromString(buf);
+ return PyString_FromString(buf);
}
static long
@@ -877,9 +877,9 @@
#endif
Py_ssize_t len;
- 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)) {
@@ -1065,7 +1065,7 @@
Py_INCREF(r);
return r;
}
- if (PyBytes_Check(r) || PyUnicode_Check(r)) {
+ if (PyString_Check(r) || PyUnicode_Check(r)) {
if (i != NULL) {
PyErr_SetString(PyExc_TypeError,
"complex() can't take second arg"
@@ -1074,7 +1074,7 @@
}
return complex_subtype_from_string(type, r);
}
- if (i != NULL && (PyBytes_Check(i) || PyUnicode_Check(i))) {
+ if (i != NULL && (PyString_Check(i) || PyUnicode_Check(i))) {
PyErr_SetString(PyExc_TypeError,
"complex() second arg can't be a string");
return NULL;
@@ -1082,7 +1082,7 @@
/* XXX Hack to support classes with __complex__ method */
if (complexstr == NULL) {
- complexstr = PyBytes_InternFromString("__complex__");
+ complexstr = PyString_InternFromString("__complex__");
if (complexstr == NULL)
return NULL;
}