Merged
requested to merge 2715-gevent-exception-cannot-switch-to-a-different-thread-scan_saving into master
Closes #2715 (closed) #2711 (closed)
ptpython uses threads which is a problem for:
- the global Redis connection pools (only one thread can use those pools)
- the
asyncio
event loop which is built on top ofgevent
usingaiogevent
(can only be used in the main thread)
So we need to remove all usage of threads in case:
- Bliss code could be called
- The
asyncio
event loop is used
All places where threads are being used which may execute Bliss code:
PythonRepl.run_async:
asyncio.get_event_loop().run_in_executor(None, ...)
PythonInput.read:
threading.Thread
PythonInput._create_buffer:
ThreadedCompleter
ThreadedAutoSuggest
All places where threads are being used which do not execute Bliss code:
PythonInput._on_input_timeout:
asyncio.get_event_loop().run_in_executor(None, ...)