diff Python/codecs.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 b7b8970cd5a5
line wrap: on
line diff
--- a/Python/codecs.c	Mon Jun 09 01:28:30 2008 +0000
+++ b/Python/codecs.c	Mon Jun 09 04:58:54 2008 +0000
@@ -61,10 +61,10 @@
 	return NULL;
     }
 	
-    v = PyBytes_FromStringAndSize(NULL, len);
+    v = PyString_FromStringAndSize(NULL, len);
     if (v == NULL)
 	return NULL;
-    p = PyBytes_AS_STRING(v);
+    p = PyString_AS_STRING(v);
     for (i = 0; i < len; i++) {
         register char ch = string[i];
         if (ch == ' ')
@@ -112,7 +112,7 @@
     v = normalizestring(encoding);
     if (v == NULL)
 	goto onError;
-    PyBytes_InternInPlace(&v);
+    PyString_InternInPlace(&v);
 
     /* First, try to lookup the name in the registry dictionary */
     result = PyDict_GetItem(interp->codec_search_cache, v);
@@ -190,7 +190,7 @@
     if (errors) {
 	PyObject *v;
 	
-	v = PyBytes_FromString(errors);
+	v = PyString_FromString(errors);
 	if (v == NULL) {
 	    Py_DECREF(args);
 	    return NULL;
@@ -451,7 +451,7 @@
 	    if (string != NULL) {
 	        PyErr_Format(PyExc_TypeError,
 		    "don't know how to handle %.400s in error callback",
-		    PyBytes_AS_STRING(string));
+		    PyString_AS_STRING(string));
 	        Py_DECREF(string);
 	    }
 	}