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
print Col # Cache the current state
Col.Count # 3
print Col # Error since the cached collection has only one element.
The attached patch changes the current behavior.
Log in to post a comment.