Skip to content

Commit a4d5fcc

Browse files
danphendersondanphenderson
andauthored
fix: bug initializing sync_playwright when using uvloop.EventPolicy. (#2311)
Co-authored-by: danphenderson <danphenderson@gmail.com>
1 parent 976f04f commit a4d5fcc

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

playwright/_impl/_connection.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -334,20 +334,22 @@ def _send_message_to_server(
334334
"line": frames[0]["line"],
335335
"column": frames[0]["column"],
336336
}
337-
if len(frames) > 0
337+
if frames
338338
else None
339339
)
340+
metadata = {
341+
"wallTime": int(datetime.datetime.now().timestamp() * 1000),
342+
"apiName": stack_trace_information["apiName"],
343+
"internal": not stack_trace_information["apiName"],
344+
}
345+
if location:
346+
metadata["location"] = location # type: ignore
340347
message = {
341348
"id": id,
342349
"guid": object._guid,
343350
"method": method,
344351
"params": self._replace_channels_with_guids(params),
345-
"metadata": {
346-
"wallTime": int(datetime.datetime.now().timestamp() * 1000),
347-
"apiName": stack_trace_information["apiName"],
348-
"location": location,
349-
"internal": not stack_trace_information["apiName"],
350-
},
352+
"metadata": metadata,
351353
}
352354
if self._tracing_count > 0 and frames and object._guid != "localUtils":
353355
self.local_utils.add_stack_to_tracing_no_reply(id, frames)

0 commit comments

Comments
 (0)