diff --git a/pyftrace/engine/pyftrace_setprofile.py b/pyftrace/engine/pyftrace_setprofile.py index 000a635..a0acb37 100644 --- a/pyftrace/engine/pyftrace_setprofile.py +++ b/pyftrace/engine/pyftrace_setprofile.py @@ -96,13 +96,13 @@ def handle_call_event(self, frame, arg, is_c_call=False): trace_this = False if self.is_stdlib_code(filename): - if not (self.verbose and module_name == 'builtins'): + if not self.verbose: return - - if self.should_trace(filename): trace_this = True - elif self.verbose: - if module_name == 'builtins': + else: + if self.should_trace(filename): + trace_this = True + elif self.verbose and module_name == 'builtins': trace_this = True if trace_this: @@ -176,16 +176,22 @@ def handle_return_event(self, frame, arg, is_c_return): if func_name == '': return - if self.is_stdlib_code(filename): - if not (self.verbose and module_name == 'builtins'): - return - trace_this = False - if self.call_stack and self.call_stack[-1] == func_name: + if self.is_stdlib_code(filename): + if not self.verbose: + return trace_this = True + else: + if self.call_stack and self.call_stack[-1] == func_name: + trace_this = True - if trace_this: + if not trace_this: + if self.verbose and module_name == 'builtins': + if self.call_stack and self.call_stack[-1] == func_name: + trace_this = True + + if trace_this and self.call_stack and self.call_stack[-1] == func_name: func_name = self.call_stack.pop() indent = " " * self.current_depth()