Skip to content

Commit 608bbb2

Browse files
chore: use asyncio.get_running_loop instead of asyncio.get_event_loop (#742)
1 parent 21b7d1c commit 608bbb2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

playwright/_impl/_sync_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
8181
class SyncBase(ImplWrapper):
8282
def __init__(self, impl_obj: Any) -> None:
8383
super().__init__(impl_obj)
84-
self._loop: asyncio.BaseEventLoop = impl_obj._loop
84+
self._loop: asyncio.AbstractEventLoop = impl_obj._loop
8585
self._dispatcher_fiber = impl_obj._dispatcher_fiber
8686

8787
def __str__(self) -> str:

playwright/async_api/_context_manager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ def __init__(self) -> None:
2727
self._connection: Connection
2828

2929
async def __aenter__(self) -> AsyncPlaywright:
30+
loop = asyncio.get_running_loop()
3031
self._connection = Connection(
3132
None,
3233
create_remote_object,
33-
PipeTransport(asyncio.get_event_loop(), compute_driver_executable()),
34+
PipeTransport(loop, compute_driver_executable()),
3435
)
35-
loop = asyncio.get_running_loop()
3636
self._connection._loop = loop
3737
loop.create_task(self._connection.run())
38-
playwright_future = asyncio.create_task(
38+
playwright_future = loop.create_task(
3939
self._connection.wait_for_object_with_known_name("Playwright")
4040
)
4141
done, pending = await asyncio.wait(

0 commit comments

Comments
 (0)