Skip to content

Commit 4e4e2a3

Browse files
committed
simplify app run
1 parent 7ff75f1 commit 4e4e2a3

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/textual/app.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,6 @@
150150
if constants.DEBUG:
151151
warnings.simplefilter("always", ResourceWarning)
152152

153-
# `asyncio.get_event_loop()` is deprecated since Python 3.10:
154-
_ASYNCIO_GET_EVENT_LOOP_IS_DEPRECATED = sys.version_info >= (3, 10, 0)
155-
156153
ComposeResult = Iterable[Widget]
157154
RenderResult: TypeAlias = "RenderableType | Visual | SupportsVisual"
158155
"""Result of Widget.render()"""
@@ -2154,13 +2151,8 @@ async def run_app() -> None:
21542151
auto_pilot=auto_pilot,
21552152
)
21562153

2157-
if _ASYNCIO_GET_EVENT_LOOP_IS_DEPRECATED:
2158-
# N.B. This doesn't work with Python<3.10, as we end up with 2 event loops:
2159-
asyncio.run(run_app(), loop_factory=None if loop is None else lambda: loop)
2160-
else:
2161-
# However, this works with Python<3.10:
2162-
event_loop = asyncio.get_event_loop() if loop is None else loop
2163-
event_loop.run_until_complete(run_app())
2154+
event_loop = asyncio.get_event_loop() if loop is None else loop
2155+
event_loop.run_until_complete(run_app())
21642156
return self.return_value
21652157

21662158
async def _on_css_change(self) -> None:

0 commit comments

Comments
 (0)