You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AsyncioSelectorReactor uses get_event_loop by default, which is nice and convenient and good... except when the policy makes it return a non-SelectorEventLoop.
ProactorEventLoop has the following limitations: The loop.add_reader() and loop.add_writer() methods are not supported.
So when you do try to use AsyncioSelectorReactor on py3.8+win, e.g. in the tests for pytest-twisted, you get a rather befuddling error:
<snip>
File "c:\projects\pytest-twisted\.tox\py38-asyncioreactor\lib\site-packages\twisted\internet\asyncioreactor.py", line 320, in install
reactor = AsyncioSelectorReactor(eventloop)
File "c:\projects\pytest-twisted\.tox\py38-asyncioreactor\lib\site-packages\twisted\internet\asyncioreactor.py", line 69, in __init__
super().__init__()
File "c:\projects\pytest-twisted\.tox\py38-asyncioreactor\lib\site-packages\twisted\internet\base.py", line 571, in __init__
self.installWaker()
File "c:\projects\pytest-twisted\.tox\py38-asyncioreactor\lib\site-packages\twisted\internet\posixbase.py", line 286, in installWaker
self.addReader(self.waker)
File "c:\projects\pytest-twisted\.tox\py38-asyncioreactor\lib\site-packages\twisted\internet\asyncioreactor.py", line 151, in addReader
self._asyncioEventloop.add_reader(fd, callWithLogger, reader,
File "C:\Python38-x64\Lib\asyncio\events.py", line 501, in add_reader
raise NotImplementedError
NotImplementedError
So, what to do? I hesitate to call the whole situation a Twisted defect, but I do think Twisted should not break in the face of something that should be detectable. I don't know really know the right way to detect this case... the first thought I had was "just typecheck against asyncio.BaseSelectorEventLoop"... which would work, but is maybe icky.
AsyncioSelectorReactor
usesget_event_loop
by default, which is nice and convenient and good... except when the policy makes it return a non-SelectorEventLoop
.In bpo-34687, Python 3.8 made ProactorEventLoop the default for Windows , and that link also states:
So when you do try to use
AsyncioSelectorReactor
on py3.8+win, e.g. in the tests for pytest-twisted, you get a rather befuddling error:So, what to do? I hesitate to call the whole situation a Twisted defect, but I do think Twisted should not break in the face of something that should be detectable. I don't know really know the right way to detect this case... the first thought I had was "just typecheck against
asyncio.BaseSelectorEventLoop
"... which would work, but is maybe icky.Searchable metadata
The text was updated successfully, but these errors were encountered: