Remove caching of enumerators
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
Caching of enumerator is could lead to an error depending on the implementation of the base collection. If the collection returns the enumerator with a copy of the current state to provide a safe enumeration any changes to the collection are not available in the enumerator.
In conjunction with the use of the enumerator in the getitem method this could lead to unexpected behavior. E.g.
Col = Application.Collection
Col.Add()
print Col[0] # Cache the current state
Col.Add()
Col.Add()
Col.Count # 3
print Col[2] # Error since the cached collection has only one element.
The attached patch changes the current behavior.