diff Objects/methodobject.c @ 47527:52294af4b663 legacy-trunk

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.
author Gregory P. Smith <greg@mad-scientist.com>
date Mon, 09 Jun 2008 04:58:54 +0000
parents 4fe192d48960
children 7dc0d2c4b520
line wrap: on
line diff
--- a/Objects/methodobject.c	Mon Jun 09 01:28:30 2008 +0000
+++ b/Objects/methodobject.c	Mon Jun 09 04:58:54 2008 +0000
@@ -149,7 +149,7 @@
 	const char *doc = m->m_ml->ml_doc;
 
 	if (doc != NULL)
-		return PyBytes_FromString(doc);
+		return PyString_FromString(doc);
 	Py_INCREF(Py_None);
 	return Py_None;
 }
@@ -157,7 +157,7 @@
 static PyObject *
 meth_get__name__(PyCFunctionObject *m, void *closure)
 {
-	return PyBytes_FromString(m->m_ml->ml_name);
+	return PyString_FromString(m->m_ml->ml_name);
 }
 
 static int
@@ -202,9 +202,9 @@
 meth_repr(PyCFunctionObject *m)
 {
 	if (m->m_self == NULL)
-		return PyBytes_FromFormat("<built-in function %s>",
+		return PyString_FromFormat("<built-in function %s>",
 					   m->m_ml->ml_name);
-	return PyBytes_FromFormat("<built-in method %s of %s object at %p>",
+	return PyString_FromFormat("<built-in method %s of %s object at %p>",
 				   m->m_ml->ml_name,
 				   m->m_self->ob_type->tp_name,
 				   m->m_self);
@@ -333,7 +333,7 @@
 	i = 0;
 	for (c = chain; c != NULL; c = c->link) {
 		for (ml = c->methods; ml->ml_name != NULL; ml++) {
-			PyList_SetItem(v, i, PyBytes_FromString(ml->ml_name));
+			PyList_SetItem(v, i, PyString_FromString(ml->ml_name));
 			i++;
 		}
 	}
@@ -360,7 +360,7 @@
 		if (strcmp(name, "__doc__") == 0) {
 			const char *doc = self->ob_type->tp_doc;
 			if (doc != NULL)
-				return PyBytes_FromString(doc);
+				return PyString_FromString(doc);
 		}
 	}
 	while (chain != NULL) {