File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1819,8 +1819,8 @@ static PyTypeObject immutable_list_type = {
18191819
18201820typedef struct {
18211821 PyObject_HEAD
1822- long it_index ;
1823- PyObject * it_seq ;
1822+ long it_index ;
1823+ PyListObject * it_seq ;
18241824} listiterobject ;
18251825
18261826PyTypeObject PyListIter_Type ;
@@ -1839,7 +1839,7 @@ list_iter(PyObject *seq)
18391839 return NULL ;
18401840 it -> it_index = 0 ;
18411841 Py_INCREF (seq );
1842- it -> it_seq = seq ;
1842+ it -> it_seq = ( PyListObject * ) seq ;
18431843 _PyObject_GC_TRACK (it );
18441844 return (PyObject * )it ;
18451845}
@@ -1855,7 +1855,7 @@ listiter_dealloc(listiterobject *it)
18551855static int
18561856listiter_traverse (listiterobject * it , visitproc visit , void * arg )
18571857{
1858- return visit (it -> it_seq , arg );
1858+ return visit (( PyObject * ) it -> it_seq , arg );
18591859}
18601860
18611861
@@ -1867,16 +1867,18 @@ listiter_getiter(PyObject *it)
18671867}
18681868
18691869static PyObject *
1870- listiter_next (PyObject * it )
1870+ listiter_next (listiterobject * it )
18711871{
1872- PyObject * seq ;
1872+ PyListObject * seq ;
18731873 PyObject * item ;
18741874
1875- assert (PyList_Check (it ));
1876- seq = ((listiterobject * )it )-> it_seq ;
1875+ assert (it != NULL );
1876+ seq = it -> it_seq ;
1877+ assert (PyList_Check (seq ));
18771878
1878- if (((listiterobject * )it )-> it_index < PyList_GET_SIZE (seq )) {
1879- item = ((PyListObject * )(seq ))-> ob_item [((listiterobject * )it )-> it_index ++ ];
1879+ if (it -> it_index < PyList_GET_SIZE (seq )) {
1880+ item = PyList_GET_ITEM (seq , it -> it_index );
1881+ ++ it -> it_index ;
18801882 Py_INCREF (item );
18811883 return item ;
18821884 }
You can’t perform that action at this time.
0 commit comments