          if 0 <= index < length:
              return index
          if correct and -length <= index < 0:
              return index + length
          raise self._IndexError('invalid index: %s' % str(index))
  
      def _check_allowed(self, items):
          if hasattr(self, '_allowed'):
              if False in [isinstance(val, self._allowed) for val in items]:
                  raise TypeError('Invalid type encountered in the arguments.')
 
</s> remove             raise GEOSIndexError('invalid GEOS Geometry index: %s' % str(index))
 </s> add             raise IndexError('invalid GEOS Geometry index: %s' % str(index)) </s> remove 
    class _IndexError:
        The type of exception to be raise on invalid index [Optional]
 </s> add  </s> remove             except self._IndexError:
 </s> add             except IndexError: </s> remove     def __iter__(self):
        "Iterate over the items in the list"
        for i in range(len(self)):
            yield self[i]

 </s> add  </s> remove             except self._IndexError:
 </s> add             except IndexError:
        raise IndexError('invalid index: %s' % str(index))
          if 0 <= index < length:
              return index
          if correct and -length <= index < 0:
              return index + length
        raise IndexError('invalid index: %s' % str(index))
  
      def _check_allowed(self, items):
          if hasattr(self, '_allowed'):
              if False in [isinstance(val, self._allowed) for val in items]:
                  raise TypeError('Invalid type encountered in the arguments.')
keep keep keep keep replace keep keep keep keep keep
 Fixed #25225 -- Simplified code to remove GEOSIndexError

The test is a regression for refs #4740 to show that the original
fix of GEOSIndexError is no longer needed. 
django/contrib/gis/geos/mutable_list.py