Python 3 asyncio selectors fix #344

Merged
akinwale merged 5 commits from python3-selector-fix into master 2018-10-28 19:12:40 +01:00
Showing only changes of commit c899ae0805 - Show all commits

View file

@ -2,6 +2,15 @@ import sys
from twisted.internet import asyncioreactor
if 'twisted.internet.reactor' not in sys.modules:
asyncioreactor.install()
eukreign commented 2018-10-28 18:44:36 +01:00 (Migrated from github.com)
Review

This might lead to confusing results if the wrong reactor was installed previously. I think it would better to either 1) just asyncioreactor.install() without putting it inside of a conditional or, alternately, 2) add an else to the existing condition which checks that the reactor installed previously is in fact an asyncioreactor.

This might lead to confusing results if the wrong reactor was installed previously. I think it would better to either 1) just `asyncioreactor.install()` without putting it inside of a conditional or, alternately, 2) add an `else` to the existing condition which checks that the reactor installed previously is in fact an `asyncioreactor`.
else:
from twisted.internet import reactor
if not isinstance(reactor, asyncioreactor.AsyncioSelectorReactor) and getattr(sys, 'frozen', False):
# pyinstaller hooks install the default reactor before
# any of our code runs, see kivy for similar problem:
# https://github.com/kivy/kivy/issues/4182
del sys.modules['twisted.internet.reactor']
asyncioreactor.install()
from twisted.internet import reactor
import keyring.backend
import platform
@ -81,7 +90,6 @@ keyring.set_keyring(LbryAndroidKeyring())
import logging.handlers
from lbrynet.core import log_support
from twisted.internet import defer, reactor
from lbrynet import analytics
from lbrynet import conf