mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Clean up references to the no longer existing PyString_ APIs in our docs.
This commit is contained in:
parent
3f885b5432
commit
4b52ae8f97
4 changed files with 23 additions and 22 deletions
|
@ -287,14 +287,14 @@ strings, so we provide a new method::
|
|||
|
||||
self = (Noddy *)type->tp_alloc(type, 0);
|
||||
if (self != NULL) {
|
||||
self->first = PyString_FromString("");
|
||||
self->first = PyUnicode_FromString("");
|
||||
if (self->first == NULL)
|
||||
{
|
||||
Py_DECREF(self);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
self->last = PyString_FromString("");
|
||||
self->last = PyUnicode_FromString("");
|
||||
if (self->last == NULL)
|
||||
{
|
||||
Py_DECREF(self);
|
||||
|
@ -449,7 +449,7 @@ concatenation of the first and last names. ::
|
|||
PyObject *args, *result;
|
||||
|
||||
if (format == NULL) {
|
||||
format = PyString_FromString("%s %s");
|
||||
format = PyUnicode_FromString("%s %s");
|
||||
if (format == NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
@ -468,7 +468,7 @@ concatenation of the first and last names. ::
|
|||
if (args == NULL)
|
||||
return NULL;
|
||||
|
||||
result = PyString_Format(format, args);
|
||||
result = PyUnicode_Format(format, args);
|
||||
Py_DECREF(args);
|
||||
|
||||
return result;
|
||||
|
@ -557,9 +557,9 @@ getting and setting the :attr:`first` attribute::
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (! PyString_Check(value)) {
|
||||
if (! PyUnicode_Check(value)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"The first attribute value must be a string");
|
||||
"The first attribute value must be a str");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1022,8 +1022,8 @@ example::
|
|||
static PyObject *
|
||||
newdatatype_repr(newdatatypeobject * obj)
|
||||
{
|
||||
return PyString_FromFormat("Repr-ified_newdatatype{{size:\%d}}",
|
||||
obj->obj_UnderlyingDatatypePtr->size);
|
||||
return PyUnicode_FromFormat("Repr-ified_newdatatype{{size:\%d}}",
|
||||
obj->obj_UnderlyingDatatypePtr->size);
|
||||
}
|
||||
|
||||
If no :attr:`tp_repr` handler is specified, the interpreter will supply a
|
||||
|
@ -1042,8 +1042,8 @@ Here is a simple example::
|
|||
static PyObject *
|
||||
newdatatype_str(newdatatypeobject * obj)
|
||||
{
|
||||
return PyString_FromFormat("Stringified_newdatatype{{size:\%d}}",
|
||||
obj->obj_UnderlyingDatatypePtr->size);
|
||||
return PyUnicode_FromFormat("Stringified_newdatatype{{size:\%d}}",
|
||||
obj->obj_UnderlyingDatatypePtr->size);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1364,11 +1364,10 @@ Here is a desultory example of the implementation of the call function. ::
|
|||
if (!PyArg_ParseTuple(args, "sss:call", &arg1, &arg2, &arg3)) {
|
||||
return NULL;
|
||||
}
|
||||
result = PyString_FromFormat(
|
||||
result = PyUnicode_FromFormat(
|
||||
"Returning -- value: [\%d] arg1: [\%s] arg2: [\%s] arg3: [\%s]\n",
|
||||
obj->obj_UnderlyingDatatypePtr->size,
|
||||
arg1, arg2, arg3);
|
||||
printf("\%s", PyString_AS_STRING(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue