[Python-3000-checkins] r55808 - python/branches/py3k-struni/Objects/stringobject.c

guido.van.rossum python-3000-checkins at python.org
Thu Jun 7 19:54:40 CEST 2007


Author: guido.van.rossum
Date: Thu Jun  7 19:54:36 2007
New Revision: 55808

Modified:
   python/branches/py3k-struni/Objects/stringobject.c
Log:
Don't lie in error messages from str8.
In some cases we use the more neutral term string; in others we are explicit.


Modified: python/branches/py3k-struni/Objects/stringobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/stringobject.c	(original)
+++ python/branches/py3k-struni/Objects/stringobject.c	Thu Jun  7 19:54:36 2007
@@ -718,7 +718,7 @@
 		else
 		{
 			PyErr_Format(PyExc_TypeError,
-				     "expected str object, "
+				     "expected string, "
 				     "%.200s found", obj->ob_type->tp_name);
 			return -1;
 		}
@@ -929,7 +929,7 @@
                 if (PyBytes_Check(bb))
 			return PyBytes_Concat((PyObject *)a, bb);
 		PyErr_Format(PyExc_TypeError,
-			     "cannot concatenate 'str' and '%.200s' objects",
+			     "cannot concatenate 'str8' and '%.200s' objects",
 			     bb->ob_type->tp_name);
 		return NULL;
 	}
@@ -2016,7 +2016,7 @@
 			return res;
 		}
 		PyErr_Format(PyExc_TypeError,
-			     "%s arg must be None or str",
+			     "%s arg must be None or string",
 			     STRIPNAME(striptype));
 		return NULL;
 	}
@@ -2026,7 +2026,7 @@
 
 
 PyDoc_STRVAR(strip__doc__,
-"S.strip([chars]) -> str\n\
+"S.strip([chars]) -> string\n\
 \n\
 Return a copy of the string S with leading and trailing\n\
 whitespace removed.\n\
@@ -2044,7 +2044,7 @@
 
 
 PyDoc_STRVAR(lstrip__doc__,
-"S.lstrip([chars]) -> str\n\
+"S.lstrip([chars]) -> string\n\
 \n\
 Return a copy of the string S with leading whitespace removed.\n\
 If chars is given and not None, remove characters in chars instead.\n\
@@ -2061,7 +2061,7 @@
 
 
 PyDoc_STRVAR(rstrip__doc__,
-"S.rstrip([chars]) -> str\n\
+"S.rstrip([chars]) -> string\n\
 \n\
 Return a copy of the string S with trailing whitespace removed.\n\
 If chars is given and not None, remove characters in chars instead.\n\
@@ -3840,7 +3840,7 @@
 
 	if (type != &PyString_Type)
 		return str_subtype_new(type, args, kwds);
-	if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:str", kwlist, &x))
+	if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:str8", kwlist, &x))
 		return NULL;
 	if (x == NULL)
 		return PyString_FromString("");
@@ -3889,7 +3889,7 @@
 }
 
 PyDoc_STRVAR(basestring_doc,
-"Type basestring cannot be instantiated; it is the base for str and unicode.");
+"Type basestring cannot be instantiated; it is the base for str8 and str.");
 
 static PyNumberMethods string_as_number = {
 	0,			/*nb_add*/
@@ -4629,7 +4629,7 @@
 					goto error;
 				if (!PyString_Check(temp)) {
 					PyErr_SetString(PyExc_TypeError,
-					  "%s argument has non-string str()");
+					  "%s argument has non-string str()/repr()");
 					Py_DECREF(temp);
 					goto error;
 				}


More information about the Python-3000-checkins mailing list