[issue30773] async generator receives wrong value when shared between coroutines

Yury Selivanov report at bugs.python.org
Thu May 24 14:39:04 EDT 2018


Yury Selivanov <yselivanov at gmail.com> added the comment:

Thanks Jan. Thanks a lot for a short script to reproduce this bug.

The actual problem here is that asynchronous generators don't control their 'asend' and 'athrow' coroutines in any way. So if you have two of them iterating *in parallel* they will cause their asynchronous generator to be in an inconsistent state.

The most obvious solution to this problem is to prohibit iterating 'asend'/'athrow' objects in parallel by throwing an exception.  

Nathaniel, what are your thoughts on this?

----------
nosy: +njs

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue30773>
_______________________________________


More information about the Python-bugs-list mailing list