Skip to content

Commit 8cd9256

Browse files
authored
fix: Make context manager __exit__/__aexit__ signatures compatible with typing protocols (#2915)
1 parent 6157d89 commit 8cd9256

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

playwright/_impl/_async_base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ async def __aenter__(self: Self) -> Self:
9696

9797
async def __aexit__(
9898
self,
99-
exc_type: Type[BaseException],
100-
exc_val: BaseException,
101-
traceback: TracebackType,
99+
exc_type: Optional[Type[BaseException]],
100+
exc_val: Optional[BaseException],
101+
traceback: Optional[TracebackType],
102102
) -> None:
103103
await self.close()
104104

playwright/_impl/_sync_base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ def __enter__(self: Self) -> Self:
142142

143143
def __exit__(
144144
self,
145-
exc_type: Type[BaseException],
146-
exc_val: BaseException,
147-
_traceback: TracebackType,
145+
exc_type: Optional[Type[BaseException]],
146+
exc_val: Optional[BaseException],
147+
_traceback: Optional[TracebackType],
148148
) -> None:
149149
self.close()
150150

0 commit comments

Comments
 (0)