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

Skip to content

Commit aa158be

Browse files
committed
Remove tp_print.
1 parent bc2e10e commit aa158be

1 file changed

Lines changed: 1 addition & 34 deletions

File tree

Modules/arraymodule.c

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,39 +1427,6 @@ PyMethodDef array_methods[] = {
14271427
{NULL, NULL} /* sentinel */
14281428
};
14291429

1430-
static int
1431-
array_print(arrayobject *a, FILE *fp, int flags)
1432-
{
1433-
int ok = 0;
1434-
int i, len;
1435-
PyObject *v;
1436-
len = a->ob_size;
1437-
if (len == 0) {
1438-
fprintf(fp, "array('%c')", a->ob_descr->typecode);
1439-
return ok;
1440-
}
1441-
if (a->ob_descr->typecode == 'c') {
1442-
PyObject *t_empty = PyTuple_New(0);
1443-
fprintf(fp, "array('c', ");
1444-
v = array_tostring(a, t_empty);
1445-
Py_DECREF(t_empty);
1446-
ok = PyObject_Print(v, fp, 0);
1447-
Py_XDECREF(v);
1448-
fprintf(fp, ")");
1449-
return ok;
1450-
}
1451-
fprintf(fp, "array('%c', [", a->ob_descr->typecode);
1452-
for (i = 0; i < len && ok == 0; i++) {
1453-
if (i > 0)
1454-
fprintf(fp, ", ");
1455-
v = (a->ob_descr->getitem)(a, i);
1456-
ok = PyObject_Print(v, fp, 0);
1457-
Py_XDECREF(v);
1458-
}
1459-
fprintf(fp, "])");
1460-
return ok;
1461-
}
1462-
14631430
static PyObject *
14641431
array_repr(arrayobject *a)
14651432
{
@@ -1719,7 +1686,7 @@ statichere PyTypeObject Arraytype = {
17191686
sizeof(arrayobject),
17201687
0,
17211688
(destructor)array_dealloc, /* tp_dealloc */
1722-
(printfunc)array_print, /* tp_print */
1689+
0, /* tp_print */
17231690
0, /* tp_getattr */
17241691
0, /* tp_setattr */
17251692
0, /* tp_compare */

0 commit comments

Comments
 (0)