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

Skip to content

Commit 442914d

Browse files
committed
Cruft cleanup: removed the #ifdef'ery in support of compiling to allow
multi-argument list.append(1, 2, 3) (as opposed to .append((1,2,3))).
1 parent 65b8b84 commit 442914d

1 file changed

Lines changed: 4 additions & 18 deletions

File tree

Objects/listobject.c

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -576,25 +576,11 @@ listinsert(PyListObject *self, PyObject *args)
576576
return ins(self, i, v);
577577
}
578578

579-
/* Define NO_STRICT_LIST_APPEND to enable multi-argument append() */
580-
581-
#ifndef NO_STRICT_LIST_APPEND
582-
#define PyArg_ParseTuple_Compat1 PyArg_ParseTuple
583-
#else
584-
#define PyArg_ParseTuple_Compat1(args, format, ret) \
585-
( \
586-
PyTuple_GET_SIZE(args) > 1 ? (*ret = args, 1) : \
587-
PyTuple_GET_SIZE(args) == 1 ? (*ret = PyTuple_GET_ITEM(args, 0), 1) : \
588-
PyArg_ParseTuple(args, format, ret) \
589-
)
590-
#endif
591-
592-
593579
static PyObject *
594580
listappend(PyListObject *self, PyObject *args)
595581
{
596582
PyObject *v;
597-
if (!PyArg_ParseTuple_Compat1(args, "O:append", &v))
583+
if (!PyArg_ParseTuple(args, "O:append", &v))
598584
return NULL;
599585
return ins(self, (int) self->ob_size, v);
600586
}
@@ -1361,7 +1347,7 @@ listindex(PyListObject *self, PyObject *args)
13611347
int i;
13621348
PyObject *v;
13631349

1364-
if (!PyArg_ParseTuple_Compat1(args, "O:index", &v))
1350+
if (!PyArg_ParseTuple(args, "O:index", &v))
13651351
return NULL;
13661352
for (i = 0; i < self->ob_size; i++) {
13671353
int cmp = PyObject_RichCompareBool(self->ob_item[i], v, Py_EQ);
@@ -1381,7 +1367,7 @@ listcount(PyListObject *self, PyObject *args)
13811367
int i;
13821368
PyObject *v;
13831369

1384-
if (!PyArg_ParseTuple_Compat1(args, "O:count", &v))
1370+
if (!PyArg_ParseTuple(args, "O:count", &v))
13851371
return NULL;
13861372
for (i = 0; i < self->ob_size; i++) {
13871373
int cmp = PyObject_RichCompareBool(self->ob_item[i], v, Py_EQ);
@@ -1399,7 +1385,7 @@ listremove(PyListObject *self, PyObject *args)
13991385
int i;
14001386
PyObject *v;
14011387

1402-
if (!PyArg_ParseTuple_Compat1(args, "O:remove", &v))
1388+
if (!PyArg_ParseTuple(args, "O:remove", &v))
14031389
return NULL;
14041390
for (i = 0; i < self->ob_size; i++) {
14051391
int cmp = PyObject_RichCompareBool(self->ob_item[i], v, Py_EQ);

0 commit comments

Comments
 (0)