Skip to content

Commit 3c2c148

Browse files
fix line too long
1 parent d531c75 commit 3c2c148

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

tornado/platform/asyncio.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,8 @@ async def thread_manager_anext() -> None:
494494
# clean up if we get to this point but the event loop is closed without
495495
# starting.
496496
self._real_loop.call_soon(
497-
lambda: self._real_loop.create_task(thread_manager_anext()), context=self._main_thread_ctx
497+
lambda: self._real_loop.create_task(thread_manager_anext()),
498+
context=self._main_thread_ctx
498499
)
499500

500501
self._readers: Dict[_FileDescriptorLike, Callable] = {}
@@ -621,7 +622,10 @@ def _run_select(self) -> None:
621622
raise
622623

623624
try:
624-
self._real_loop.call_soon_threadsafe(self._handle_select, rs, ws, context=self._main_thread_ctx)
625+
self._real_loop.call_soon_threadsafe(
626+
self._handle_select, rs, ws,
627+
context=self._main_thread_ctx
628+
)
625629
except RuntimeError:
626630
# "Event loop is closed". Swallow the exception for
627631
# consistency with PollIOLoop (and logical consistency

tornado/test/asyncio_test.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,11 +276,14 @@ def get_app(self) -> Application:
276276
class Handler(RequestHandler):
277277
async def get(self):
278278
# On the Windows platform,
279-
# when a asyncio.events.Handle is created in the SelectorThread without providing a context,
279+
# when a asyncio.events.Handle is created
280+
# in the SelectorThread without providing a context,
280281
# it will copy the current thread's context,
281-
# which can lead to the loss of the main thread's context when executing the handle.
282+
# which can lead to the loss of the main thread's context
283+
# when executing the handle.
282284
# Therefore, it is necessary to
283-
# save a copy of the main thread's context in the SelectorThread for creating the handle.
285+
# save a copy of the main thread's context in the SelectorThread
286+
# for creating the handle.
284287
self.write(tornado_test_ctx.get())
285288

286289
return Application([(self.test_endpoint, Handler)])

0 commit comments

Comments
 (0)