Skip to content

Commit 408ddde

Browse files
committed
Fix formatting
1 parent 855532e commit 408ddde

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

trio_asyncio/_loop.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ def set_event_loop(self, loop):
182182
else:
183183
super().set_event_loop(loop)
184184

185+
185186
# get_event_loop() without a running loop is deprecated in 3.12+. The logic for emitting the
186187
# DeprecationWarning walks the stack looking at module names in order to associate it with
187188
# the first caller outside asyncio. We need to pretend to be asyncio in order for that to work.
@@ -190,6 +191,7 @@ def set_event_loop(self, loop):
190191

191192
# Make sure we don't try to continue using the Trio loop after a fork()
192193
if hasattr(os, "register_at_fork"):
194+
193195
def _clear_state_after_fork():
194196
if _in_trio_context():
195197
from trio._core._run import GLOBAL_RUN_CONTEXT
@@ -240,6 +242,7 @@ def _new_policy_set(new_policy):
240242

241243
_orig_run_get = _aio_event._get_running_loop
242244

245+
243246
def _new_run_get():
244247
try:
245248
task = trio.lowlevel.current_task()
@@ -252,6 +255,7 @@ def _new_run_get():
252255
# Not Trio context
253256
return _orig_run_get()
254257

258+
255259
# Must override the non-underscore-prefixed get_running_loop() too,
256260
# else will use the C-accelerated one which doesn't call the patched
257261
# _get_running_loop()
@@ -261,6 +265,7 @@ def _new_run_get_or_throw():
261265
raise RuntimeError("no running event loop")
262266
return result
263267

268+
264269
_aio_event._get_running_loop = _new_run_get
265270
_aio_event.get_running_loop = _new_run_get_or_throw
266271
asyncio._get_running_loop = _new_run_get
@@ -298,9 +303,11 @@ def _new_loop_new():
298303
# accesses the non-monkeypatched version of _get_running_loop()
299304
from asyncio import current_task as _orig_current_task
300305

306+
301307
def _new_current_task(loop=None):
302308
return _orig_current_task(loop or _new_run_get())
303309

310+
304311
asyncio.tasks.current_task = _new_current_task
305312
asyncio.current_task = _new_current_task
306313

0 commit comments

Comments
 (0)