mirror of
https://github.com/python/cpython.git
synced 2025-08-31 22:18:28 +00:00
Kill all uses and definitions of tp_print under Objects/. (Others will follow.)
Finally kill intobject.c, which was #ifdef'ed out a long time ago.
This commit is contained in:
parent
d474ce8c7a
commit
04dbf3b5ec
11 changed files with 11 additions and 1470 deletions
|
@ -565,50 +565,6 @@ set_dealloc(PySetObject *so)
|
|||
Py_TRASHCAN_SAFE_END(so)
|
||||
}
|
||||
|
||||
static int
|
||||
set_tp_print(PySetObject *so, FILE *fp, int flags)
|
||||
{
|
||||
setentry *entry;
|
||||
Py_ssize_t pos=0;
|
||||
char *emit = ""; /* No separator emitted on first pass */
|
||||
char *separator = ", ";
|
||||
int literalform = 0;
|
||||
int status = Py_ReprEnter((PyObject*)so);
|
||||
|
||||
if (status != 0) {
|
||||
if (status < 0)
|
||||
return status;
|
||||
fprintf(fp, "%s(...)", Py_Type(so)->tp_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!so->used) {
|
||||
Py_ReprLeave((PyObject*)so);
|
||||
fprintf(fp, "%s()", Py_Type(so)->tp_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (Py_Type(so) == &PySet_Type) {
|
||||
literalform = 1;
|
||||
fprintf(fp, "{");
|
||||
} else
|
||||
fprintf(fp, "%s([", Py_Type(so)->tp_name);
|
||||
while (set_next(so, &pos, &entry)) {
|
||||
fputs(emit, fp);
|
||||
emit = separator;
|
||||
if (PyObject_Print(entry->key, fp, 0) != 0) {
|
||||
Py_ReprLeave((PyObject*)so);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (literalform)
|
||||
fputs("}", fp);
|
||||
else
|
||||
fputs("])", fp);
|
||||
Py_ReprLeave((PyObject*)so);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
set_repr(PySetObject *so)
|
||||
{
|
||||
|
@ -1957,7 +1913,7 @@ PyTypeObject PySet_Type = {
|
|||
0, /* tp_itemsize */
|
||||
/* methods */
|
||||
(destructor)set_dealloc, /* tp_dealloc */
|
||||
(printfunc)set_tp_print, /* tp_print */
|
||||
0, /* tp_print */
|
||||
0, /* tp_getattr */
|
||||
0, /* tp_setattr */
|
||||
set_nocmp, /* tp_compare */
|
||||
|
@ -2050,7 +2006,7 @@ PyTypeObject PyFrozenSet_Type = {
|
|||
0, /* tp_itemsize */
|
||||
/* methods */
|
||||
(destructor)set_dealloc, /* tp_dealloc */
|
||||
(printfunc)set_tp_print, /* tp_print */
|
||||
0, /* tp_print */
|
||||
0, /* tp_getattr */
|
||||
0, /* tp_setattr */
|
||||
set_nocmp, /* tp_compare */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue