dbrattli / dbrattli/aioreactive
from_iterable does not handle exceptions in iterables
- Dominant language
- Python
- Stars
- 401
- Forks
- 25
- PR merge metrics
- No merged PRs in 30d
Description
```python
import asyncio
from aioreactive.core import AsyncObservable, run
async def generator():
# Also fails with sync generators
for i in range(10):
if i > 2:
print("Let's raise")
raise ValueError(i)
# stream hangs here
await asyncio.sleep(.1)
print('Yield', i)
yield i
async def main():
iterable = generator()
observer = AsyncObservable.from_iterable(iterable)
await run(observer, timeout=None)
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()
```
So the flow is simply hangs after the exception is thrown in the generator
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at AsyncObservable.from_iterable and reproduce the issue with the async generator shown in the report, including the equivalent sync-generator case. Trace how exceptions from the iterable are handled and verify that the flow no longer hangs after ValueError is raised.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100