Expose unfinished tasks and shutdown status in asyncio.Queue

When working with queue = asyncio.Queue(), there is a way to get the number of items currently waiting to be processed using queue.qsize(). However, there is no way to get the number of tasks currently being processed. The queue internally keeps track of these items in queue._unfinished_tasks, although that attribute it is not intended to be used by a consumer since it starts with a leading underscore. The same applies to queue._is_shutdown.

It would be nice to expose these in the public facing API.

1 Like

What is the use-case for exposing those as public attributes?