Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit875fd2a

Browse files
committed
Employasyncio.Runner in the asyncio REPL
1 parent393aaad commit875fd2a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

‎Lib/asyncio/__main__.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ def interrupt(self) -> None:
192192
from_pyrepl.mainimportCAN_USE_PYREPL
193193

194194
return_code=0
195-
loop=asyncio.new_event_loop()
196-
asyncio.set_event_loop(loop)
195+
runner=asyncio.Runner()
196+
loop=runner.get_loop()
197197

198198
repl_locals= {'asyncio':asyncio}
199199
forkeyin {'__name__','__package__',
@@ -245,4 +245,5 @@ def interrupt(self) -> None:
245245
break
246246

247247
console.write('exiting asyncio REPL...\n')
248+
runner.close()
248249
sys.exit(return_code)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp