-
Matias Guijarro authored
Threads have been introduced in ptpython 3.0.11 ; the input UI runs in a separate thread. In addition, default completers also run in threads. This is a problem for us, for 3 reasons: - aiogevent sets up a gevent backend for asyncio, as a result operations that run in an executor for example are executing in different gevent hubs ; it is not safe to share gevent objects between threads - when showing results, code is called from another thread - as we display `__info__` strings which can communicate via sockets etc, we get "cannot switch to a different thread" error since sockets cannot be shared between gevent loops in different threads - when executing properties and methods discovery for completion, there is a possibility of communication via sockets, to get redis keys (for example), this cannot be executed in another thread (same reason as above) This code overwrites ._create_buffer(), .read() and .run_async() in order to provide versions with no threads ; in our case there is no blocking because we use aiogevent for asyncio + monkey-patched Python so we can avoid threads. completely.
f86ceeea