Thanks for the detailed answer.
Moving the data loading out of __iter__
and into __next__
fixed the problem.
It would be even better if that “here” was replaced by “inside __iter__()”.
If the list of places where this call wouldn’t work is long, then a reference to a documentation page that lists those places.
Maybe this is not a bug after all, and this post should be back in the Q&A section with your answer marked as solution?