Skip to content

Commit 822dcac

Browse files
committed
Only retrieve first 10 frames from callstack, for performance reasons
1 parent ac5cd71 commit 822dcac

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

playwright/_impl/_connection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ def _send_message_to_server(
333333
task = asyncio.current_task(self._loop)
334334
callback.stack_trace = cast(
335335
traceback.StackSummary,
336-
getattr(task, "__pw_stack_trace__", traceback.extract_stack()),
336+
getattr(task, "__pw_stack_trace__", traceback.extract_stack(limit=10)),
337337
)
338338
callback.no_reply = no_reply
339339
self._callbacks[id] = callback
@@ -388,7 +388,7 @@ def dispatch(self, msg: ParsedMessagePayload) -> None:
388388
error["error"], format_call_log(msg.get("log")) # type: ignore
389389
)
390390
parsed_error._stack = "".join(
391-
traceback.format_list(callback.stack_trace)[-10:]
391+
traceback.format_list(callback.stack_trace)
392392
)
393393
callback.future.set_exception(parsed_error)
394394
else:

playwright/_impl/_sync_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def _sync(
106106
g_self = greenlet.getcurrent()
107107
task: asyncio.tasks.Task[Any] = self._loop.create_task(coro)
108108
setattr(task, "__pw_stack__", inspect.stack(0))
109-
setattr(task, "__pw_stack_trace__", traceback.extract_stack())
109+
setattr(task, "__pw_stack_trace__", traceback.extract_stack(limit=10))
110110

111111
task.add_done_callback(lambda _: g_self.switch())
112112
while not task.done():

0 commit comments

Comments
 (0)