From b5b08f334eb03f111f2ec4e9d00f6df5898bc4b3 Mon Sep 17 00:00:00 2001 From: Alex Hall Date: Sat, 4 May 2019 21:12:41 +0200 Subject: [PATCH] Optimisation: return None when not tracing frame to avoid line events --- pysnooper/tracer.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pysnooper/tracer.py b/pysnooper/tracer.py index b1a027a..927e158 100644 --- a/pysnooper/tracer.py +++ b/pysnooper/tracer.py @@ -242,20 +242,20 @@ class Tracer: # We did the most common and quickest check above, because the # trace function runs so incredibly often, therefore it's # crucial to hyper-optimize it for the common case. - return self.trace + return None elif self._is_internal_frame(frame): - return self.trace + return None else: _frame_candidate = frame for i in range(1, self.depth): _frame_candidate = _frame_candidate.f_back if _frame_candidate is None: - return self.trace + return None elif self._should_trace_frame(_frame_candidate): indent = ' ' * 4 * i break else: - return self.trace + return None else: indent = '' # #