gh-160573: Drop the set once when a shared iterator is exhausted (#160619)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
3 files changed