First, let me thank you very much for this great book! Fluent Python is very pedagogical, informative and quite a pleasure to read.
So, I have been quite surprised to encounter a bug when running flags2_asyncio.py, in the error accounting in the supervisor function. After a first error happens, all downloads are counted as erroneous, even when they are in fact successful. This is because the "error" variable is never reset after entering the for loop.
This can be fixed simply by adding "else: error = None" at the end of the try/except (parallel to what you do in flags2_threadpool.py and flags2_asyncio_executor.py).
First, let me thank you very much for this great book! Fluent Python is very pedagogical, informative and quite a pleasure to read.
So, I have been quite surprised to encounter a bug when running flags2_asyncio.py, in the error accounting in the supervisor function. After a first error happens, all downloads are counted as erroneous, even when they are in fact successful. This is because the "error" variable is never reset after entering the for loop. This can be fixed simply by adding "else: error = None" at the end of the try/except (parallel to what you do in flags2_threadpool.py and flags2_asyncio_executor.py).
This bug is also present in flags3_asyncio.py.
(I am using Python3.10.)
A big thank you again!