vxgmichel / aiostream

Generator-based operators for asynchronous iteration
http://aiostream.readthedocs.io
GNU General Public License v3.0
801 stars 34 forks source link

Copy pending set before iterating and discarding #74

Closed cstruct closed 3 years ago

cstruct commented 3 years ago

Calling self.cancel_task in __aexit__ was never safe when having pending tasks. Since self.cancel_tasks modifies self._pending we need to copy the set and iterate over that snapshot.

This fixes vxgmichel/aiostream#73

vxgmichel commented 3 years ago

Thanks for the PR! #75 is taking over now :)