From 8d29609294dfacad223737d50ed0be214a2fd421 Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Sun, 13 Oct 2024 15:04:32 +0200 Subject: [PATCH] Fix #2011: Test the divisor, not the dividend for zero --- debug_toolbar/panels/profiling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debug_toolbar/panels/profiling.py b/debug_toolbar/panels/profiling.py index b946f9f04..4613a3cad 100644 --- a/debug_toolbar/panels/profiling.py +++ b/debug_toolbar/panels/profiling.py @@ -90,7 +90,7 @@ def subfuncs(self): count = len(self.statobj.all_callees[self.func]) for i, (func, stats) in enumerate(self.statobj.all_callees[self.func].items()): h1 = h + ((i + 1) / count) / (self.depth + 1) - s1 = 0 if stats[3] == 0 else s * (stats[3] / self.stats[3]) + s1 = 0 if self.stats[3] == 0 else s * (stats[3] / self.stats[3]) yield FunctionCall( self.statobj, func,