jquast / telnetlib3

Python Telnet server and client Protocol library using asyncio
Other
144 stars 32 forks source link

Incorrect get_event_loop call #85

Open robgom opened 5 months ago

robgom commented 5 months ago

Hi there, inside stream_reader and stream_writer (at least) there are calls to "asyncio.get_event_policy().get_event_loop()". That doesn't always work, like in my case - I wanted to provide sync wrapper for async methods, so I create a new event loop. That event loop is not the one for get_event_policy(), which is the default one. When I replaced "asyncio.get_event_policy().get_event_loop()" with "asyncio.get_event_loop()", which should behave the same according to Python documentation ("If there is no running event loop set, the function will return the result of the get_event_loop_policy().get_event_loop() call."), things started working for me. I believe that should work for others, too.

telnetlib3==2.0.4 OS - Windows

I'd need significantly more time to provide complete snippet of code to demonstrate the issue.