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/Parser/asdl_c.py b/Parser/asdl_c.py
index 0d6c5c0..25ff424 100755
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -375,7 +375,7 @@
# there's really nothing more we can do if this fails ...
self.emit("if (tmp == NULL) goto failed;", 1)
error = "expected some sort of %s, but got %%.400s" % name
- format = "PyErr_Format(PyExc_TypeError, \"%s\", PyBytes_AS_STRING(tmp));"
+ format = "PyErr_Format(PyExc_TypeError, \"%s\", PyString_AS_STRING(tmp));"
self.emit(format % error, 1, reflow=False)
self.emit("failed:", 0)
self.emit("Py_XDECREF(tmp);", 1)
@@ -704,7 +704,7 @@
fnames = PyTuple_New(num_fields);
if (!fnames) return NULL;
for (i = 0; i < num_fields; i++) {
- PyObject *field = PyBytes_FromString(fields[i]);
+ PyObject *field = PyString_FromString(fields[i]);
if (!field) {
Py_DECREF(fnames);
return NULL;
@@ -723,7 +723,7 @@
PyObject *s, *l = PyTuple_New(num_fields);
if (!l) return 0;
for(i = 0; i < num_fields; i++) {
- s = PyBytes_FromString(attrs[i]);
+ s = PyString_FromString(attrs[i]);
if (!s) {
Py_DECREF(l);
return 0;
@@ -797,7 +797,7 @@
PyObject *s = PyObject_Repr(obj);
if (s == NULL) return 1;
PyErr_Format(PyExc_ValueError, "invalid integer value: %.400s",
- PyBytes_AS_STRING(s));
+ PyString_AS_STRING(s));
Py_DECREF(s);
return 1;
}
@@ -815,7 +815,7 @@
PyObject *s = PyObject_Repr(obj);
if (s == NULL) return 1;
PyErr_Format(PyExc_ValueError, "invalid boolean value: %.400s",
- PyBytes_AS_STRING(s));
+ PyString_AS_STRING(s));
Py_DECREF(s);
return 1;
}