Contribute a new gevent-compliant event loop (see issue #112)#130
Contribute a new gevent-compliant event loop (see issue #112)#130mguijarr wants to merge 2 commits intoprompt-toolkit:mainfrom
Conversation
…t#112) The gevent-compliant event loop is activated by passing `gevent=True` to the `embed` method of `repl` module. The event loop code is heavily inspired from the prompt-toolkit POSIX event loop, adapted to gevent. More details in file `contrib/gevent_eventloop.py`
|
Thanks for this pull request, I really appreciate it. I'm not merging it however. After I discovered some issues, I took some time to debug the issue and found that it can be solved like in this change in prompt-toolkit: prompt-toolkit/python-prompt-toolkit@ac26b02 Does that work for you? |
|
@jonathanslenders thanks a lot for having considered my PR and to take a look at the problem with gevent. Your proposal does fix the issue with It is a common idiom I think to not patch threads, for example if someone wants to do some heavy computation in threads but still wants to use gevent for non-blocking I/O. So, even with the new code the following consumes all file descriptors (look at (in reality I did my tests with ptpython in REPL, I guess the code above with the |
|
@jonathanslenders, was a decision made on which route to take on this? It's not clear, was issue #112 solved via the prompt-toolkit commit you mentioned? |
The gevent-compliant event loop is activated by passing
gevent=Trueto the
embedmethod ofreplmodule.The event loop code is heavily inspired from the prompt-toolkit POSIX
event loop, adapted to gevent. More details in file
contrib/gevent_eventloop.py