Skip to content

Commit

Permalink
Test usage of proactor event loop
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Nov 10, 2023
1 parent 9f0b540 commit a5dafd1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
30 changes: 15 additions & 15 deletions qtconsole/qtconsoleapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,21 +397,21 @@ def _init_asyncio_patch(self):
FIXME: if/when tornado supports the defaults in asyncio,
remove and bump tornado requirement for py38
"""
if sys.platform.startswith("win") and sys.version_info >= (3, 8):
import asyncio
try:
from asyncio import (
WindowsProactorEventLoopPolicy,
WindowsSelectorEventLoopPolicy,
)
except ImportError:
pass
# not affected
else:
if type(asyncio.get_event_loop_policy()) is WindowsProactorEventLoopPolicy:
# WindowsProactorEventLoopPolicy is not compatible with tornado 6
# fallback to the pre-3.8 default of Selector
asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())
# if sys.platform.startswith("win") and sys.version_info >= (3, 8):
# import asyncio
# try:
# from asyncio import (
# WindowsProactorEventLoopPolicy,
# WindowsSelectorEventLoopPolicy,
# )
# except ImportError:
# pass
# # not affected
# else:
# if type(asyncio.get_event_loop_policy()) is WindowsProactorEventLoopPolicy:
# # WindowsProactorEventLoopPolicy is not compatible with tornado 6
# # fallback to the pre-3.8 default of Selector
# asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())

@catch_config_error
def initialize(self, argv=None):
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
'qtpy>=2.4.0',
'pyzmq>=17.1',
'packaging'
'tornado==6.3.3'
],
extras_require = {
'test': ['flaky', 'pytest', 'pytest-qt'],
Expand Down

0 comments on commit a5dafd1

Please sign in to comment.