Fix to list remove bug
This commit is contained in:
parent
e37764f5af
commit
ca81c772d8
|
@ -169,6 +169,12 @@ class FastIndexUniqueList( collections.abc.MutableSequence ):
|
||||||
|
|
||||||
def __delitem__( self, index ):
|
def __delitem__( self, index ):
|
||||||
|
|
||||||
|
# only clean state is when we take what is the last item _at this point in time_
|
||||||
|
# previously this test was after the delete and it messed everything up hey
|
||||||
|
removing_last_item_in_list = index in ( -1, len( self._list ) - 1 )
|
||||||
|
|
||||||
|
if removing_last_item_in_list:
|
||||||
|
|
||||||
item = self._list[ index ]
|
item = self._list[ index ]
|
||||||
del self._list[ index ]
|
del self._list[ index ]
|
||||||
|
|
||||||
|
@ -177,7 +183,9 @@ class FastIndexUniqueList( collections.abc.MutableSequence ):
|
||||||
del self._items_to_indices[ item ]
|
del self._items_to_indices[ item ]
|
||||||
|
|
||||||
|
|
||||||
if index not in ( -1, len( self._list ) - 1 ):
|
else:
|
||||||
|
|
||||||
|
del self._list[ index ]
|
||||||
|
|
||||||
self._DirtyIndices()
|
self._DirtyIndices()
|
||||||
|
|
||||||
|
@ -272,7 +280,7 @@ class FastIndexUniqueList( collections.abc.MutableSequence ):
|
||||||
self._list.extend( items )
|
self._list.extend( items )
|
||||||
|
|
||||||
|
|
||||||
def index( self, item ):
|
def index( self, item, **kwargs ):
|
||||||
"""
|
"""
|
||||||
This is fast!
|
This is fast!
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue