harvimt / quamash

Implementation of the PEP 3156 event-loop (asyncio) api using the Qt Event-Loop
BSD 2-Clause "Simplified" License
264 stars 46 forks source link

QThreadExecutor should inherit from concurrent.futures.ThreadPoolExecutor #102

Open stevenwinfield opened 5 years ago

stevenwinfield commented 5 years ago

According to the Python 3.7 docs

awaitable loop.run_in_executor(executor, func, *args) Arrange for func to be called in the specified executor. The executor argument should be an concurrent.futures.Executor instance. The default executor is used if executor is None.

and, more strictly:

loop.set_default_executor(executor) Set executor as the default executor used by run_in_executor(). executor should be an instance of ThreadPoolExecutor. Deprecated since version 3.7: Using an executor that is not an instance of ThreadPoolExecutor is deprecated and will trigger an error in Python 3.9. executor must be an instance of concurrent.futures.ThreadPoolExecutor.

So it looks like QThreadExecutor will need to inherit from concurrent.futures.ThreadPoolExecutor to keep everyone happy.