touch up str docstrings #3284

This commit is contained in:
Benjamin Peterson 2008-07-04 19:55:29 +00:00
parent a819caadef
commit 142957ce95

View file

@ -260,7 +260,7 @@ int unicode_resize(register PyUnicodeObject *unicode,
unicode->str[0] < 256U && unicode->str[0] < 256U &&
unicode_latin1[unicode->str[0]] == unicode)) { unicode_latin1[unicode->str[0]] == unicode)) {
PyErr_SetString(PyExc_SystemError, PyErr_SetString(PyExc_SystemError,
"can't resize shared unicode objects"); "can't resize shared str objects");
return -1; return -1;
} }
@ -377,14 +377,14 @@ void unicode_dealloc(register PyUnicodeObject *unicode)
Py_REFCNT(unicode) = 3; Py_REFCNT(unicode) = 3;
if (PyDict_DelItem(interned, (PyObject *)unicode) != 0) if (PyDict_DelItem(interned, (PyObject *)unicode) != 0)
Py_FatalError( Py_FatalError(
"deletion of interned unicode string failed"); "deletion of interned string failed");
break; break;
case SSTATE_INTERNED_IMMORTAL: case SSTATE_INTERNED_IMMORTAL:
Py_FatalError("Immortal interned unicode string died."); Py_FatalError("Immortal interned string died.");
default: default:
Py_FatalError("Inconsistent interned unicode string state."); Py_FatalError("Inconsistent interned string state.");
} }
if (PyUnicode_CheckExact(unicode) && if (PyUnicode_CheckExact(unicode) &&
@ -1107,7 +1107,7 @@ PyObject *PyUnicode_FromEncodedObject(register PyObject *obj,
if (PyUnicode_Check(obj)) { if (PyUnicode_Check(obj)) {
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
"decoding Unicode is not supported"); "decoding str is not supported");
return NULL; return NULL;
} }
@ -1125,7 +1125,7 @@ PyObject *PyUnicode_FromEncodedObject(register PyObject *obj,
case of a TypeError. */ case of a TypeError. */
if (PyErr_ExceptionMatches(PyExc_TypeError)) if (PyErr_ExceptionMatches(PyExc_TypeError))
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
"coercing to Unicode: need string or buffer, " "coercing to str: need string or buffer, "
"%.80s found", "%.80s found",
Py_TYPE(obj)->tp_name); Py_TYPE(obj)->tp_name);
goto onError; goto onError;
@ -1206,7 +1206,7 @@ PyObject *PyUnicode_Decode(const char *s,
goto onError; goto onError;
if (!PyUnicode_Check(unicode)) { if (!PyUnicode_Check(unicode)) {
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
"decoder did not return a unicode object (type=%.400s)", "decoder did not return a str object (type=%.400s)",
Py_TYPE(unicode)->tp_name); Py_TYPE(unicode)->tp_name);
Py_DECREF(unicode); Py_DECREF(unicode);
goto onError; goto onError;
@ -1263,7 +1263,7 @@ PyObject *PyUnicode_AsDecodedUnicode(PyObject *unicode,
goto onError; goto onError;
if (!PyUnicode_Check(v)) { if (!PyUnicode_Check(v)) {
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
"decoder did not return a unicode object (type=%.400s)", "decoder did not return a str object (type=%.400s)",
Py_TYPE(v)->tp_name); Py_TYPE(v)->tp_name);
Py_DECREF(v); Py_DECREF(v);
goto onError; goto onError;
@ -1388,7 +1388,7 @@ PyObject *PyUnicode_AsEncodedUnicode(PyObject *unicode,
goto onError; goto onError;
if (!PyUnicode_Check(v)) { if (!PyUnicode_Check(v)) {
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
"encoder did not return an unicode object (type=%.400s)", "encoder did not return an str object (type=%.400s)",
Py_TYPE(v)->tp_name); Py_TYPE(v)->tp_name);
Py_DECREF(v); Py_DECREF(v);
goto onError; goto onError;
@ -1525,7 +1525,7 @@ int unicode_decode_call_errorhandler(const char *errors, PyObject **errorHandler
Py_ssize_t *endinpos, PyObject **exceptionObject, const char **inptr, Py_ssize_t *endinpos, PyObject **exceptionObject, const char **inptr,
PyObject **output, Py_ssize_t *outpos, Py_UNICODE **outptr) PyObject **output, Py_ssize_t *outpos, Py_UNICODE **outptr)
{ {
static char *argparse = "O!n;decoding error handler must return (unicode, int) tuple"; static char *argparse = "O!n;decoding error handler must return (str, int) tuple";
PyObject *restuple = NULL; PyObject *restuple = NULL;
PyObject *repunicode = NULL; PyObject *repunicode = NULL;
@ -3601,7 +3601,7 @@ static PyObject *unicode_encode_call_errorhandler(const char *errors,
Py_ssize_t startpos, Py_ssize_t endpos, Py_ssize_t startpos, Py_ssize_t endpos,
Py_ssize_t *newpos) Py_ssize_t *newpos)
{ {
static char *argparse = "O!n;encoding error handler must return (unicode, int) tuple"; static char *argparse = "O!n;encoding error handler must return (str, int) tuple";
PyObject *restuple; PyObject *restuple;
PyObject *resunicode; PyObject *resunicode;
@ -4264,7 +4264,7 @@ PyObject *PyUnicode_DecodeCharmap(const char *s,
else { else {
/* wrong return value */ /* wrong return value */
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
"character mapping must return integer, None or unicode"); "character mapping must return integer, None or str");
Py_DECREF(x); Py_DECREF(x);
goto onError; goto onError;
} }
@ -4864,7 +4864,7 @@ static PyObject *unicode_translate_call_errorhandler(const char *errors,
Py_ssize_t startpos, Py_ssize_t endpos, Py_ssize_t startpos, Py_ssize_t endpos,
Py_ssize_t *newpos) Py_ssize_t *newpos)
{ {
static char *argparse = "O!n;translating error handler must return (unicode, int) tuple"; static char *argparse = "O!n;translating error handler must return (str, int) tuple";
Py_ssize_t i_newpos; Py_ssize_t i_newpos;
PyObject *restuple; PyObject *restuple;
@ -4954,7 +4954,7 @@ int charmaptranslate_lookup(Py_UNICODE c, PyObject *mapping, PyObject **result)
else { else {
/* wrong return value */ /* wrong return value */
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
"character mapping must return integer, None or unicode"); "character mapping must return integer, None or str");
Py_DECREF(x); Py_DECREF(x);
return -1; return -1;
} }
@ -6352,7 +6352,7 @@ convert_uc(PyObject *obj, void *addr)
PyDoc_STRVAR(center__doc__, PyDoc_STRVAR(center__doc__,
"S.center(width[, fillchar]) -> str\n\ "S.center(width[, fillchar]) -> str\n\
\n\ \n\
Return S centered in a Unicode string of length width. Padding is\n\ Return S centered in a string of length width. Padding is\n\
done using the specified fill character (default is a space)"); done using the specified fill character (default is a space)");
static PyObject * static PyObject *
@ -6551,12 +6551,12 @@ PyObject *PyUnicode_RichCompare(PyObject *left,
PyErr_Clear(); PyErr_Clear();
if (PyErr_WarnEx(PyExc_UnicodeWarning, if (PyErr_WarnEx(PyExc_UnicodeWarning,
(op == Py_EQ) ? (op == Py_EQ) ?
"Unicode equal comparison " "equal comparison "
"failed to convert both arguments to Unicode - " "failed to convert both arguments to str - "
"interpreting them as being unequal" "interpreting them as being unequal"
: :
"Unicode unequal comparison " "Unicode unequal comparison "
"failed to convert both arguments to Unicode - " "failed to convert both arguments to str - "
"interpreting them as being unequal", "interpreting them as being unequal",
1) < 0) 1) < 0)
return NULL; return NULL;
@ -6662,7 +6662,7 @@ PyDoc_STRVAR(count__doc__,
"S.count(sub[, start[, end]]) -> int\n\ "S.count(sub[, start[, end]]) -> int\n\
\n\ \n\
Return the number of non-overlapping occurrences of substring sub in\n\ Return the number of non-overlapping occurrences of substring sub in\n\
Unicode string S[start:end]. Optional arguments start and end are\n\ string S[start:end]. Optional arguments start and end are\n\
interpreted as in slice notation."); interpreted as in slice notation.");
static PyObject * static PyObject *
@ -7411,7 +7411,7 @@ do_argstrip(PyUnicodeObject *self, int striptype, PyObject *args)
return _PyUnicode_XStrip(self, striptype, sep); return _PyUnicode_XStrip(self, striptype, sep);
else { else {
PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
"%s arg must be None, unicode or str", "%s arg must be None or str",
STRIPNAME(striptype)); STRIPNAME(striptype));
return NULL; return NULL;
} }
@ -7426,8 +7426,7 @@ PyDoc_STRVAR(strip__doc__,
\n\ \n\
Return a copy of the string S with leading and trailing\n\ Return a copy of the string S with leading and trailing\n\
whitespace removed.\n\ whitespace removed.\n\
If chars is given and not None, remove characters in chars instead.\n\ If chars is given and not None, remove characters in chars instead.");
If chars is a str, it will be converted to unicode before stripping");
static PyObject * static PyObject *
unicode_strip(PyUnicodeObject *self, PyObject *args) unicode_strip(PyUnicodeObject *self, PyObject *args)
@ -7443,8 +7442,7 @@ PyDoc_STRVAR(lstrip__doc__,
"S.lstrip([chars]) -> str\n\ "S.lstrip([chars]) -> str\n\
\n\ \n\
Return a copy of the string S with leading whitespace removed.\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\ If chars is given and not None, remove characters in chars instead.");
If chars is a str, it will be converted to unicode before stripping");
static PyObject * static PyObject *
unicode_lstrip(PyUnicodeObject *self, PyObject *args) unicode_lstrip(PyUnicodeObject *self, PyObject *args)
@ -7460,8 +7458,7 @@ PyDoc_STRVAR(rstrip__doc__,
"S.rstrip([chars]) -> str\n\ "S.rstrip([chars]) -> str\n\
\n\ \n\
Return a copy of the string S with trailing whitespace removed.\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\ If chars is given and not None, remove characters in chars instead.");
If chars is a str, it will be converted to unicode before stripping");
static PyObject * static PyObject *
unicode_rstrip(PyUnicodeObject *self, PyObject *args) unicode_rstrip(PyUnicodeObject *self, PyObject *args)
@ -7810,7 +7807,7 @@ unicode_rindex(PyUnicodeObject *self, PyObject *args)
PyDoc_STRVAR(rjust__doc__, PyDoc_STRVAR(rjust__doc__,
"S.rjust(width[, fillchar]) -> str\n\ "S.rjust(width[, fillchar]) -> str\n\
\n\ \n\
Return S right justified in a Unicode string of length width. Padding is\n\ Return S right justified in a string of length width. Padding is\n\
done using the specified fill character (default is a space)."); done using the specified fill character (default is a space).");
static PyObject * static PyObject *
@ -8059,7 +8056,7 @@ PyDoc_STRVAR(maketrans__doc__,
Return a translation table usable for str.translate().\n\ Return a translation table usable for str.translate().\n\
If there is only one argument, it must be a dictionary mapping Unicode\n\ If there is only one argument, it must be a dictionary mapping Unicode\n\
ordinals (integers) or characters to Unicode ordinals, strings or None.\n\ ordinals (integers) or characters to Unicode ordinals, strings or None.\n\
Character keys will then be converted to ordinals.\n\ Character keys will be then converted to ordinals.\n\
If there are two arguments, they must be strings of equal length, and\n\ If there are two arguments, they must be strings of equal length, and\n\
in the resulting dictionary, each character in x will be mapped to the\n\ in the resulting dictionary, each character in x will be mapped to the\n\
character at the same position in y. If there is a third argument, it\n\ character at the same position in y. If there is a third argument, it\n\
@ -8161,7 +8158,7 @@ PyDoc_STRVAR(translate__doc__,
\n\ \n\
Return a copy of the string S, where all characters have been mapped\n\ Return a copy of the string S, where all characters have been mapped\n\
through the given translation table, which must be a mapping of\n\ through the given translation table, which must be a mapping of\n\
Unicode ordinals to Unicode ordinals, Unicode strings or None.\n\ Unicode ordinals to Unicode ordinals, strings, or None.\n\
Unmapped characters are left untouched. Characters mapped to None\n\ Unmapped characters are left untouched. Characters mapped to None\n\
are deleted."); are deleted.");