Skip to content

Commit

Permalink
chore: use asyncio.get_running_loop instead of `asyncio.get_event_l…
Browse files Browse the repository at this point in the history
…oop` (#742)
  • Loading branch information
kumaraditya303 authored Jun 7, 2021
1 parent 21b7d1c commit 608bbb2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion playwright/_impl/_sync_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
class SyncBase(ImplWrapper):
def __init__(self, impl_obj: Any) -> None:
super().__init__(impl_obj)
self._loop: asyncio.BaseEventLoop = impl_obj._loop
self._loop: asyncio.AbstractEventLoop = impl_obj._loop
self._dispatcher_fiber = impl_obj._dispatcher_fiber

def __str__(self) -> str:
Expand Down
6 changes: 3 additions & 3 deletions playwright/async_api/_context_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ def __init__(self) -> None:
self._connection: Connection

async def __aenter__(self) -> AsyncPlaywright:
loop = asyncio.get_running_loop()
self._connection = Connection(
None,
create_remote_object,
PipeTransport(asyncio.get_event_loop(), compute_driver_executable()),
PipeTransport(loop, compute_driver_executable()),
)
loop = asyncio.get_running_loop()
self._connection._loop = loop
loop.create_task(self._connection.run())
playwright_future = asyncio.create_task(
playwright_future = loop.create_task(
self._connection.wait_for_object_with_known_name("Playwright")
)
done, pending = await asyncio.wait(
Expand Down

0 comments on commit 608bbb2

Please sign in to comment.