Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 346f1a8

Browse files
committed
Kill remaining tp_print definitions.
1 parent 04dbf3b commit 346f1a8

3 files changed

Lines changed: 4 additions & 76 deletions

File tree

Modules/_collectionsmodule.c

Lines changed: 2 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -633,46 +633,6 @@ deque_repr(PyObject *deque)
633633
return result;
634634
}
635635

636-
static int
637-
deque_tp_print(PyObject *deque, FILE *fp, int flags)
638-
{
639-
PyObject *it, *item;
640-
char *emit = ""; /* No separator emitted on first pass */
641-
char *separator = ", ";
642-
int i;
643-
644-
i = Py_ReprEnter(deque);
645-
if (i != 0) {
646-
if (i < 0)
647-
return i;
648-
fputs("[...]", fp);
649-
return 0;
650-
}
651-
652-
it = PyObject_GetIter(deque);
653-
if (it == NULL)
654-
return -1;
655-
656-
fputs("deque([", fp);
657-
while ((item = PyIter_Next(it)) != NULL) {
658-
fputs(emit, fp);
659-
emit = separator;
660-
if (PyObject_Print(item, fp, 0) != 0) {
661-
Py_DECREF(item);
662-
Py_DECREF(it);
663-
Py_ReprLeave(deque);
664-
return -1;
665-
}
666-
Py_DECREF(item);
667-
}
668-
Py_ReprLeave(deque);
669-
Py_DECREF(it);
670-
if (PyErr_Occurred())
671-
return -1;
672-
fputs("])", fp);
673-
return 0;
674-
}
675-
676636
static PyObject *
677637
deque_richcompare(PyObject *v, PyObject *w, int op)
678638
{
@@ -824,7 +784,7 @@ static PyTypeObject deque_type = {
824784
0, /* tp_itemsize */
825785
/* methods */
826786
(destructor)deque_dealloc, /* tp_dealloc */
827-
deque_tp_print, /* tp_print */
787+
0, /* tp_print */
828788
0, /* tp_getattr */
829789
0, /* tp_setattr */
830790
0, /* tp_compare */
@@ -1179,22 +1139,6 @@ defdict_dealloc(defdictobject *dd)
11791139
PyDict_Type.tp_dealloc((PyObject *)dd);
11801140
}
11811141

1182-
static int
1183-
defdict_print(defdictobject *dd, FILE *fp, int flags)
1184-
{
1185-
int sts;
1186-
fprintf(fp, "defaultdict(");
1187-
if (dd->default_factory == NULL)
1188-
fprintf(fp, "None");
1189-
else {
1190-
PyObject_Print(dd->default_factory, fp, 0);
1191-
}
1192-
fprintf(fp, ", ");
1193-
sts = PyDict_Type.tp_print((PyObject *)dd, fp, 0);
1194-
fprintf(fp, ")");
1195-
return sts;
1196-
}
1197-
11981142
static PyObject *
11991143
defdict_repr(defdictobject *dd)
12001144
{
@@ -1277,7 +1221,7 @@ static PyTypeObject defdict_type = {
12771221
0, /* tp_itemsize */
12781222
/* methods */
12791223
(destructor)defdict_dealloc, /* tp_dealloc */
1280-
(printfunc)defdict_print, /* tp_print */
1224+
0, /* tp_print */
12811225
0, /* tp_getattr */
12821226
0, /* tp_setattr */
12831227
0, /* tp_compare */

Modules/_sqlite/row.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,6 @@ PyObject* pysqlite_row_keys(pysqlite_Row* self, PyObject* args, PyObject* kwargs
159159
return list;
160160
}
161161

162-
static int pysqlite_row_print(pysqlite_Row* self, FILE *fp, int flags)
163-
{
164-
return (&PyTuple_Type)->tp_print(self->data, fp, flags);
165-
}
166-
167162
static PyObject* pysqlite_iter(pysqlite_Row* self)
168163
{
169164
return PyObject_GetIter(self->data);
@@ -188,7 +183,7 @@ PyTypeObject pysqlite_RowType = {
188183
sizeof(pysqlite_Row), /* tp_basicsize */
189184
0, /* tp_itemsize */
190185
(destructor)pysqlite_row_dealloc, /* tp_dealloc */
191-
(printfunc)pysqlite_row_print, /* tp_print */
186+
0, /* tp_print */
192187
0, /* tp_getattr */
193188
0, /* tp_setattr */
194189
0, /* tp_compare */

PC/_winreg.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -387,17 +387,6 @@ PyHKEY_intFunc(PyObject *ob)
387387
return PyLong_FromVoidPtr(pyhkey->hkey);
388388
}
389389

390-
static int
391-
PyHKEY_printFunc(PyObject *ob, FILE *fp, int flags)
392-
{
393-
PyHKEYObject *pyhkey = (PyHKEYObject *)ob;
394-
char resBuf[160];
395-
wsprintf(resBuf, "<PyHKEY at %p (%p)>",
396-
ob, pyhkey->hkey);
397-
fputs(resBuf, fp);
398-
return 0;
399-
}
400-
401390
static PyObject *
402391
PyHKEY_strFunc(PyObject *ob)
403392
{
@@ -464,7 +453,7 @@ PyTypeObject PyHKEY_Type =
464453
sizeof(PyHKEYObject),
465454
0,
466455
PyHKEY_deallocFunc, /* tp_dealloc */
467-
PyHKEY_printFunc, /* tp_print */
456+
0, /* tp_print */
468457
PyHKEY_getattr, /* tp_getattr */
469458
0, /* tp_setattr */
470459
PyHKEY_compareFunc, /* tp_compare */

0 commit comments

Comments
 (0)