@@ -362,12 +362,7 @@ def _send_message_to_server(
362362 "params" : self ._replace_channels_with_guids (params ),
363363 "metadata" : metadata ,
364364 }
365- if (
366- self ._tracing_count > 0
367- and frames
368- and frames
369- and object ._guid != "localUtils"
370- ):
365+ if self ._tracing_count > 0 and frames and object ._guid != "localUtils" :
371366 self .local_utils .add_stack_to_tracing_no_reply (id , frames )
372367
373368 self ._transport .send (message )
@@ -519,7 +514,10 @@ async def wrap_api_call(
519514 if self ._api_zone .get ():
520515 return await cb ()
521516 task = asyncio .current_task (self ._loop )
522- st : List [inspect .FrameInfo ] = getattr (task , "__pw_stack__" , inspect .stack ())
517+ st : List [inspect .FrameInfo ] = getattr (
518+ task , "__pw_stack__" , None
519+ ) or inspect .stack (0 )
520+
523521 parsed_st = _extract_stack_trace_information_from_stack (st , is_internal )
524522 self ._api_zone .set (parsed_st )
525523 try :
@@ -535,7 +533,9 @@ def wrap_api_call_sync(
535533 if self ._api_zone .get ():
536534 return cb ()
537535 task = asyncio .current_task (self ._loop )
538- st : List [inspect .FrameInfo ] = getattr (task , "__pw_stack__" , inspect .stack ())
536+ st : List [inspect .FrameInfo ] = getattr (
537+ task , "__pw_stack__" , None
538+ ) or inspect .stack (0 )
539539 parsed_st = _extract_stack_trace_information_from_stack (st , is_internal )
540540 self ._api_zone .set (parsed_st )
541541 try :
@@ -619,4 +619,4 @@ def format_call_log(log: Optional[List[str]]) -> str:
619619 return ""
620620 if len (list (filter (lambda x : x .strip (), log ))) == 0 :
621621 return ""
622- return "\n Call log:\n " + "\n - " .join (log ) + "\n "
622+ return "\n Call log:\n " + "\n " .join (log ) + "\n "
0 commit comments