Kaydet (Commit) 189f1df3 authored tarafından Guido van Rossum's avatar Guido van Rossum

Add a proper implementation for the tp_str slot (returning self, of

course), so I can get rid of the special case for strings in
PyObject_Str().
üst 09e563ab
......@@ -401,6 +401,13 @@ string_repr(register PyStringObject *op)
}
}
static PyObject *
string_str(PyObject *s)
{
Py_INCREF(s);
return s;
}
static int
string_length(PyStringObject *a)
{
......@@ -2374,7 +2381,7 @@ PyTypeObject PyString_Type = {
0, /*tp_as_mapping*/
(hashfunc)string_hash, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
(reprfunc)string_str, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
&string_as_buffer, /*tp_as_buffer*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment